Uses a docker-compose.yml
config file to launch docker containers and settings.
https://docs.docker.com/compose/install/
or use install script from DevOps-Bash-tools:
install/install_docker_compose.sh
version="$(docker-compose version --short)"
curl -L "https://raw.githubusercontent.com/docker/compose/$version/contrib/completion/bash/docker-compose" \
-o /etc/bash_completion.d/docker-compose
Start / restart containers from docker-compose.yml
and docker-compose.override.yml
export COMPOSE_FILE=jenkins-docker-compose.yml
docker-compose up
Notable Switches:
Switch | Description |
---|---|
-d | detached |
-p | <project_name> |
-f | alternative-docker-compose.yml |
docker-compose -d -f docker-compose.yml -f docker-compose.prod.yml up
Only starts previously created containers
docker-compose start
Equivalent of docker run -ti
:
docker-compose run -e DEBUG=1 $service $command
If DEBUG
doesn't have a value argument it'll take DEBUG from the environment variable DEBUG
docker-compose exec $service $command
docker-compose down