dockerfile-patterns
FreeNo executable scriptsNot checkedUse when the user asks about writing, optimizing, or debugging Dockerfiles, containerizing applications, or building Docker images with docker build. Covers…
by uw-ssec★ 33 GitHub starsAbout this skill
Dockerfile Patterns
Primary Actions
- Create production-ready Dockerfiles for common language stacks.
- Reduce image size with multi-stage build separation.
- Improve build speed with layer-cache-friendly ordering.
- Apply baseline security hardening defaults.
- Choose fit-for-purpose base images for runtime constraints.
Quick Build Pattern
FROM python:3.11 AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --prefix=/install -r requirements.txt
COPY . .
FROM python:3.11-slim
WORKDIR /app
COPY --from=builder /install /usr/local
COPY --from=builder /app /app
RUN useradd -u 1001 -m appuser
USER 1001
ENTRYPOINT ["python", "-m", "myapp"]
Validation Workflow
- Build the image (
docker build). - Run startup check (
docker run --rm <image> --helpor equivalent). - For services, run a smoke check with expected command/port.
- Run vulnerability scan before release (
trivy imageordocker scout cves). - If validation fails, revise Dockerfile and rebuild.
Language Templates
- assets/python-dockerfile.dockerfile
- assets/node-dockerfile.dockerfile
- assets/rust-dockerfile.dockerfile
- assets/r-dockerfile.dockerfile
Deep References
- Multi-stage design patterns: references/multi-stage-builds.md
- Layer caching patterns and cache debugging: references/layer-caching.md
- Base image selection decision guidance: references/base-image-selection.md
- Validation gates,
.dockerignore, security defaults, and common failure patterns: references/build-validation-and-ops.md
Install dockerfile-patterns in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
FAQ
What does the dockerfile-patterns skill do?
Use when the user asks about writing, optimizing, or debugging Dockerfiles, containerizing applications, or building Docker images with docker build. Covers multi-stage builds, layer caching, base image selection, security hardening, and language-specific patterns for Python, Node, Rust, R, Go, Julia, and C/C++.
How do I install the dockerfile-patterns skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the dockerfile-patterns skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
by Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
by Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
by Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
by Anthropic