Compose
Running multiple containers
Last updated
Was this helpful?
Running multiple containers
Last updated
Was this helpful?
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.
Commands
To start
To tear down
compose can also build your images
will build them with docker-compose up
if not found in cache
also rebuild with docker-compose build
great for complex builds that have lots of vars or build args
Example
"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 it
on-failure
- only restart if the container stops with an error code
unless-stopped
- always restart unless we forcibly stop it