Compose
Running multiple containers
Why
Configure relationships between containers
Save docker container run settings in easy-to-read file
create one-liner development environment startups
Comprised of 2 separate but related things:
YAML formatted file that describes solution options for:
containers
volumes
networks
A CLI tool docker-compose used for local dev/test automation
Installed automatically on Mac and Windows with Docker Desktop, for Linux must be downloaded separately.
Links
Example
Commands
To start
To tear down
Using compose with build
compose can also build your images
will build them with
docker-compose up
if not found in cachealso rebuild with
docker-compose build
great for complex builds that have lots of vars or build args
Example
Restart policies
"no"
- never attempt to restart this container if it stops or crashes (must be in "")always
- if this container stops, for any reason, always attempt to restart iton-failure
- only restart if the container stops with an error codeunless-stopped
- always restart unless we forcibly stop it
Last updated