Docker Compose
Advanced
Overview
Compose describes a whole stack in docker-compose.yml: each service is a container with its image, ports, environment, volumes, and dependencies.
docker compose up starts everything; add -d to detach. docker compose down stops and removes the stack. Services automatically share a network and can talk by service name.
Use the 'docker run to Compose' utility on this site to convert an existing docker run command into a Compose service quickly.
Cheatsheet
docker compose up -dStart the stack in the backgrounddocker compose downStop and remove the stackdocker compose psList the stack's containersdocker compose logs -fFollow logs from all servicesdocker compose buildBuild images defined in the fileTry it
A safe, simulated terminal. Run the suggested commands to see typical output.
simulated terminal
Type a command and press Enter, or click a suggestion below to run it.
Quick quiz
1. What command starts a Compose stack in the background?
2. How do services in a Compose file address each other?