Use when requests involve docker compose files, local or ephemeral stacks, service orchestration, environment-specific compose variants, or making multi-container development environments reliable and maintainable. Design and operate Docker Compose environments for local development, testing, and small multi-service runtime stacks: service boundaries, profiles, environment layering, dependency startup, healthchecks, volumes, networks, and override strategy.
Docker Compose is for expressing multi-service environments coherently, not merely starting a pile of containers. Prefer explicit service contracts, environment layering, health-aware startup, and scoped overrides so local and ephemeral stacks stay predictable.
| Situation | Action |
|---|---|
| Environment has optional supporting services | Use profiles or overrides rather than one always-on stack. |
| App depends on database readiness, not just container startup | Add healthchecks and readiness-aware dependency handling. |
| Local development needs source-code live editing | Use bind mounts carefully and keep production-like concerns separate. |
| CI stack must be clean and deterministic | Prefer ephemeral state and explicit teardown. |
| One compose file is accumulating conflicting environment assumptions | Split common and environment-specific concerns with overrides or profiles. |
references/compose-environments-playbook.mdreferences/compose-environments-checklist.md