Loading...
Loading...
Use this skill when creating, modifying, or debugging Docker Compose configurations, even if the user just says they need to wire services together, add a database to their stack, or set up a local development environment with multiple containers. Covers service definitions, health checks, dependency ordering, volumes, networks, environment variables, and development overrides.
npx skill4agent add docker/skills docker-compose-patternscompose.yamlcompose.override.yamlcompose.yamlcompose.override.yamlDockerfilecompose.yamldocker-compose.ymldocker-compose.yamlwebdbcacheworkerlatestrestart: unless-stoppedcontainer_namedepends_oncondition: service_healthydepends_onhealthcheckdepends_onhealthcheckpg_isreadyredis-cli pingmysqladmin pingintervaltimeoutretriesstart_periodinterval: 5stimeout: 3sretries: 3start_period: 10sservices:
api:
build:
context: .
target: runtime # distroless / hardened image
ports:
- "8080:8080"
# No healthcheck here — the image has no tools to run one
api-health:
image: curlimages/curl:8
network_mode: "service:api" # shares api's localhost
entrypoint: ["sleep", "infinity"] # keep sidecar alive for healthcheck
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 45s
deploy:
resources:
limits:
memory: 32Mentrypoint: ["sleep", "infinity"]network_mode: "service:api"localhostapi worker:
depends_on:
api-health:
condition: service_healthyvolumes:networks:environment:env_file:.envcompose.yamlenv_file:environment:${DB_PASSWORD:-postgres}.env.gitignorecompose.override.yamlcompose.yamldevelop.watchcompose.yamldevelop.watchaction: syncaction: rebuildpackage.jsonrequirements.txtaction: sync+restartdocker compose down -vdocker compose down --volumesdocker volume rmdocker volume prunedocker-destructive-guardrailsexternal: truedown -vdocker volume rm-fdocker compose rm -vdocker compose down-vdocker compose restartdocker-project-foundations.dockerignoredocker-build-strategiesdocker system prunedocker rm -fdocker-destructive-guardrailsreferences/service-dependencies.mddepends_onreferences/volumes-and-networks.mdassets/compose-web-app.yamlassets/compose-dev-override.yamlassets/bad-vs-good.mdscripts/verify-compose.shcompose.yamldocker compose config --quietbash scripts/verify-compose.sh [--help]0docker compose config --quiet2docker compose configenv_filechecks/verification.md