Build, repair, and harden Docker-based development and deployment setups for applications and services. Use when any agent needs to create or update `Dockerfile`, `.dockerignore`, `compose.yaml` or `docker-compose.yml`, container entrypoints, multi-stage builds, local service orchestration, or container debugging workflows. Trigger for requests such as containerizing a Node/Python/Go app, adding Postgres or Redis with Compose, shrinking images, fixing container startup failures, debugging port or volume issues, improving Docker caching, or making a container setup safer for production.
Use this skill to move from "make this run in Docker" to a working, debuggable setup with sane defaults. Prefer small, reviewable changes and preserve the app's current run behavior unless the user asks to change it.
For concrete starter patterns, read examples.md.
Choose the path that matches the request:
Dockerfile, .dockerignore, and optionally compose.yaml.compose.yaml with app, database, cache, and named volumes as needed.Read the app before editing container files:
package.json, pyproject.toml, requirements.txt, go.mod, Gemfile, or framework config.localhost, file paths, and missing bind addresses.If the stack-specific pattern is not obvious, read recipes.md.
Follow this order:
.dockerignore before broad COPY steps to keep build context small.Prefer these defaults:
0.0.0.0, not 127.0.0.1.CMD and ENTRYPOINT.Use Compose when the app needs supporting services or a repeatable local workflow.
Include:
db, redis, or workerCompose rules:
localhost.depends_on plus healthchecks over sleep-based startup hacks.Work from symptoms to root cause:
Common fixes:
0.0.0.0.WORKDIR, COPY, or build output path.localhost.If the failure pattern matches a known Docker issue, read troubleshooting.md.
Apply these by default unless they conflict with the app:
latest tags in examples when a major version is known..env files or secrets into the image.Do not over-engineer:
Before finishing, verify that:
docker build, docker run, or docker compose up