Docker Compose Helper
Help users create, review, and repair Docker Compose setups with the smallest working change that fits their local development workflow.
Workflow
- Identify the user's goal:
- creating a new compose file
- adding or changing a service
- debugging startup, networking, volume, or environment issues
- translating a
docker runcommand into compose
- Inspect existing files before editing:
compose.yamlcompose.ymldocker-compose.yamldocker-compose.yml.env- Dockerfiles referenced by
build
- Prefer Docker Compose v2 syntax:
- omit the obsolete top-level
version - use
compose.yamlif creating a new file - keep service names lowercase and stable
- omit the obsolete top-level
- Make the smallest useful change. Do not add orchestration, custom networks, or named volumes unless the service needs them.
Compose Defaults
- Use explicit image tags instead of
latestwhen a stable tag is obvious. - Use named volumes for database state.
- Use bind mounts for application source during local development.
- Put secrets and machine-specific values in
.env, not directly in YAML. - Add
depends_ononly for startup ordering; addhealthcheckwhen readiness actually matters. - Expose only the host ports the user needs.
Debugging Checklist
When debugging, check these in order:
- YAML validity and indentation.
- Whether the service name, image, build context, and Dockerfile path exist.
- Port conflicts between host ports and already-running services.
- Volume paths and whether a bind mount hides files built into the image.
- Environment variable names,
.envloading, and missing required values. - Container-to-container networking: services should use service names as DNS
hosts, not
localhost. - Readiness problems: add a healthcheck and condition only when the dependent service truly must wait.
Output
When editing files, show the changed compose snippet or file path and explain the reason for each non-obvious setting in one short sentence.