
Dockerfile Optimise
This is a comprehensive reference of 48 Docker optimization rules pulled straight from official Docker docs, organized into 8 priority-ranked categories from layer caching to security hardening. It's designed to trigger when you're writing or reviewing Dockerfiles, giving you specific patterns like cache mounts for package managers, multi-stage build strategies, and secret mount handling. The rules come with impact ratings (CRITICAL/HIGH/MEDIUM) so you know what actually matters for build time and image size versus what's just polish. Honestly most useful as a systematic checklist when you're past the "just get it working" stage and want to do things properly, especially the cache invalidation and base image selection guidance that people usually learn through pain.
- skills.sh installs
- 351
- GitHub stars
- 222
- last updated
- Aug 21, 2026
Install
$ npx -y skills add pproenca/dot-skills --skill dockerfile-optimise --agent claude-codeInstalls into .claude/skills of the current project.
Files
Dockerfile Optimization Best Practices
Comprehensive Dockerfile optimization guide sourced exclusively from official Docker documentation. Contains 48 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.
When to Apply
Reference these guidelines when:
- Writing new Dockerfiles or modifying existing ones
- Optimizing Docker build times (layer caching, cache mounts, context management)
- Reducing Docker image size (multi-stage builds, minimal base images)
- Hardening container security (secret mounts, non-root users, attestations)
- Setting up CI/CD pipelines with Docker builds
- Reviewing Dockerfiles for anti-patterns
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Layer Caching & Ordering | CRITICAL | cache- |
| 2 | Multi-Stage Builds | CRITICAL | stage- |
| 3 | Base Image Selection | HIGH | base- |
| 4 | Build Context Management | HIGH | ctx- |
| 5 | Security & Secrets | HIGH | sec- |
| 6 | Dependency Management | MEDIUM-HIGH | dep- |
| 7 | Instruction Patterns | MEDIUM | inst- |
| 8 | Quality & Validation | MEDIUM | lint- |
Sponsors
Details
- Repository
- github.com/pproenca/dot-skills
- Categories
- Security, DevOps & CI/CD, Documentation, Code Review & Quality
- First seen
- Jun 3, 2026
More from pproenca/dot-skills
All 100- Uniwind348
- 37signals Rails340
- Ast Grep340
- Audio Voice Recovery340
- Orval338
- Mui Base335
- Codemod334
- Vhs331
- Skill Authoring330
- Unix Cli326
- Python323
- Rust Refactor322
- Ios Design System319
- 12 Factor App318
- Js Google317
- Tailwind Refactor314
- Pulumi310
- Harness Engineering305
- Ios Hig303
- Rails Testing301
- Think301
- Ruby Refactor299
- Ios Xcode298
- Restful Hateoas298