docker-patterns
Master Dockerfile optimization, multi-stage builds, docker-compose patterns, security hardening, and image size reduction techniques for production-grade containerization.
npx skills add cosmicstack-labs/mercury-agent-skills --skill docker-patterns --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Docker Patterns: Production-Grade Containerization ## Overview Docker patterns encompass the art and science of building efficient, secure, and maintainable container images. This skill covers the entire lifecycle — from writing optimized Dockerfiles and orchestrating multi-service environments with docker-compose to hardening images against vulnerabilities and minimizing attack surface. Mastery of these patterns is essential for any DevOps practitioner aiming to ship reliable, fast, and secure software. --- ## Core Principles 1. **Minimalism** — Every layer, every package, every instruction adds weight and risk. Include only what the runtime needs, nothing more. 2. **Reproducibility** — Builds must produce identical images given the same source. Pin base image tags, lock dependency versions, and avoid network-dependent build steps. 3. **Cache Efficiency** — Order Dockerfile instructions from least to most frequently changing to maximize layer cache reuse. This transforms build times from minutes to seconds. 4. **Defense in Depth** — Never run containers as root. Use read-only root filesystems. Drop all unnecessary Linux capabilities. Scan images before deployment. 5. **Single Re
- Overview
- Core Principles
- Docker Maturity Model
- 🟢 Beginner
- 🟡 Proficient
- 🔴 Expert
- Actionable Guidance
- 1. Multi-Stage Builds
- 2. Dockerfile Best Practices
- 3. Docker Compose Patterns
- 4. Security Best Practices
- Common Mistakes
Scan image trivy image --severity HIGH,CRITICAL myapp:latest Scan Dockerfile for misconfigurations trivy config --severity HIGH,CRITICAL Dockerfile CI integration trivy image --exit-code 1 --severity CRITICAL myapp:latest docker run --privileged --pid=host \ docker/docker-bench-security
What does the docker-patterns skill do?
Master Dockerfile optimization, multi-stage builds, docker-compose patterns, security hardening, and image size reduction techniques for production-grade containerization.
How do I install it?
Run `npx skills add cosmicstack-labs/mercury-agent-skills --skill docker-patterns --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From cosmicstack-labs/mercury-agent-skills, a repository with 364 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.