Loading...
Loading...
Docker containerization for development and production. Covers Dockerfiles, multi-stage builds, layer caching, Compose services, networking, volumes, health checks, security hardening, and production deployment patterns. Use when writing Dockerfiles, optimizing image size, configuring Compose services, debugging container networking, setting up health checks, hardening containers for production, or troubleshooting build cache issues.
npx skill4agent add oakoss/agent-skills docker| Pattern | Approach | Key Points |
|---|---|---|
| Multi-stage build | Separate | 80%+ image size reduction, no dev deps in production |
| Layer caching | Copy lockfile first, install, then copy source | Dependency layer cached across builds |
| Non-root user | | Never run production containers as root |
| Health check | | Enables orchestrator restart on failure |
| Exclude | Smaller build context, faster builds |
| Compose services | | Dev environment in one command |
| Compose override | | Environment-specific config without duplication |
| Named volumes | | Survives container recreation |
| Build cache mount | | Persistent cache across builds |
| Secrets in build | | Never bake secrets into image layers |
| Image pinning | Pin to major.minor or digest | Reproducible builds, avoid surprise breakage |
| Container networking | Custom bridge networks with service discovery | Containers resolve each other by service name |
| Compose watch | | Live reload without volume mounts |
| Init process | | Proper signal handling and zombie reaping |
| Multi-platform | | ARM (Apple Silicon, Graviton) + x86 in one image |
| Monorepo prune | | Minimal build context from workspace dependencies |
| CI layer caching | | Avoid full rebuilds in CI pipelines |
| Debug containers | | Inspect running containers and image layers |
| Mistake | Correct Pattern |
|---|---|
| Installing dev dependencies in production image | Multi-stage build: install in builder, copy artifacts to runtime |
| Copying source before installing dependencies | Copy lockfile first, |
| Running as root in production | Create non-root user, |
| Hardcoding secrets in Dockerfile or ENV | Use build secrets ( |
Using | Pin to specific version ( |
No | Exclude |
Using | |
| HEALTHCHECK missing | Add health check for orchestrator integration |
Large base images ( | Use alpine variants ( |
Ignoring | |
| Building entire monorepo for one service | Use |
| No layer caching in CI | Use |
| Building only for x86 when deploying to ARM | Use |
TaskExplorePlanIf theskill is available, delegate CI/CD pipeline and deployment strategy to it. If theci-cd-architectureskill is available, delegate container security scanning and hardening review to it.application-security