Agent skill · Security

docker-patterns

Master Dockerfile optimization, multi-stage builds, docker-compose patterns, security hardening, and image size reduction techniques for production-grade containerization.

Cosmic Stack3,294★ · 2 repos on radarProfile →
claude-codeMIT
Install
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.

Facts
Files in the skill folder: 1
SKILL.md size: 11 KB
Bundled scripts: none
Version: 1.0.0
Declared author: cosmicstack-labs
Path: categories/devops/docker-patterns/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 364
Language: JavaScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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

What's inside
Steps it walks through
  1. Overview
  2. Core Principles
  3. Docker Maturity Model
  4. 🟢 Beginner
  5. 🟡 Proficient
  6. 🔴 Expert
  7. Actionable Guidance
  8. 1. Multi-Stage Builds
  9. 2. Dockerfile Best Practices
  10. 3. Docker Compose Patterns
  11. 4. Security Best Practices
  12. Common Mistakes
Commands it runs
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
More from mercury-agent-skills
All skills →
About this skill
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.

Keep going