Ref: https://learn.cantrill.io/courses/docker-fundamentals/lectures/44660846 =OR= https://www.youtube.com/watch?v=L2S9cm43fVY
What is Docker Compose?
- 🔧 Docker Compose is SW used for defining & running multi-container Docker applications
- Handles multiple containers simultaneously in PROD, STAGE, DEV, TEST and CI environments
- Manages the whole SW Development LifeCycle (SDLC)
- Docker Compose file
- Written in YAML
- File name either
compose.yaml
(new) or docker-compose.yml
(old)
- Configures application's services with rules specifying how to run them
- Allows to start, stop, or rebuild all the services using a single command
Docker Compose - Commands
docker compose up
- dockerd starts to run/update containers, volumes and NWs
- Creates, adjusts & deletes resources
- Smart enough to only adjust what's required to make physical containers match the logical containers in the file
- e.g. if volumes existed before, it won't (re)create them
docker compose down
- stops & removes all containers specified in Docker Compose file
- ‼️ Does NOT remove volumes!
- volumes must be manually removed (if desired)
Docker Compose Summary Diagram
