@tank/docker-production-patterns
Installation
SKILL.md
Docker Production Patterns
Core Philosophy
- Ship the minimum viable image — Every unnecessary binary, library, and shell in the final image is attack surface and wasted bandwidth. Multi-stage builds exist to separate build-time from run-time.
- Layers are the caching unit — Order instructions from least-changing (base image, system deps) to most-changing (application code). A single misordered COPY invalidates every subsequent layer.
- Containers are ephemeral — Design for termination. Handle SIGTERM, drain connections, flush buffers. If your container cannot stop cleanly in 10 seconds, the architecture is wrong.
- Security is not optional — Run as non-root, use read-only filesystems, scan images in CI, never bake secrets into layers. The default Docker setup is insecure for production.
- Compose is not just for dev — With profiles, resource limits, health checks, and secrets, Compose serves single-host production. Know when to graduate to orchestrators.