Compose as a Team Workflow
Why Teams Standardize on Compose
- Onboarding:
git clone && docker compose upreplaces a 3-page setup wiki - Review: infrastructure changes show up in diffs like code changes
- Parity: dev runs the same stack shape as CI and (small-scale) production
Environment-specific config comes from env files, not edits:
api:
image: orders-api:${TAG:-latest}
env_file: .env
environment:
DB_HOST: db
Useful commands beyond up/down:
| Command | Does |
|---|---|
docker compose up -d --build | rebuild images that changed, then up |
docker compose restart web | restart one service |
docker compose exec web sh | shell into a running service |
docker compose config | print the fully-resolved file (great for debugging YAML) |
docker compose pull | update all images |
Note: Compose is perfect up to "a handful of services on one host." The moment you need multi-host scheduling, self-healing and rolling deploys, that's Kubernetes - a different track, same mental models you're building here.
Goal: The Declare the Stack lab gives you the requirements doc; you write the compose file and bring up web + redis with volumes, ports and restart policies.