docker-patterns
Skill1 starsChanged 57 days agoMITView on GitHub
Docker and Compose standards for multi-stage builds, pinned base images, non-root runtime users, named volumes, network isolation, build-time and runtime secrets, and the Trivy, SBOM and cosign supply-chain gate. Use when you say "write a Dockerfile for this service", "set up compose for local dev", "my container cannot reach the database", "shrink this image", or "scan and sign this image before we push". Not for Kubernetes manifests and rollout strategy, use `deployment-patterns`.
- Reads credentials
32 other projects use a version of this.
Adopted by
Most recently taken up by
- ku5ic/claude-kittheir own version, first seen Oct 6, 2026
- imMamdouhaboammar/tiktok-growth-automation-meshtheir own version, first seen Oct 1, 2026
- productionx-in/Core-Skillstheir own version, first seen Sep 29, 2026
- lintangknitto/agent-skillstheir own version, first seen Sep 23, 2026
- ZeroTokenClaw/agents-skillstheir own version, first seen Sep 21, 2026
- sabahattink/antigravity-fullstack-hqtheir own version, first seen Sep 20, 2026
Used with
Projects with it also use content-hash-cache-pattern, carrier-relationship-management and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
InfopibeSkillcontent-hash-cache-pattern
Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.
Also in 10 projects that use this
InfopibeSkillcarrier-relationship-management
Codified expertise for managing carrier portfolios, negotiating freight rates, tracking carrier performance, allocating freight, and maintaining strategic carrier relationships. Informed by transportation managers with 15+ years experience. Includes scorecarding frameworks, RFP processes, market intelligence, and compliance vetting. Use when managing carriers, negotiating rates, evaluating carrier performance, or building freight strategies.
Also in 8 projects that use this
saxon-ySkillconfigure-ecc
Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.
Also in 9 projects that use this
- +6 more from Infopibe
Other versions32 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 32
- xu-xiang/everything-claude-code-zh★ 2ksame name
- loulanyue/awesome-claude-notes★ 272same name
- tpavanipradeep/everything-claude-code★ 134same name
- langchain-ai/skills-benchmarks★ 118same name
- templetongroup/radiant★ 113same name
- Jamkris/everything-gemini-code★ 87same name
- tranhieutt/software_development_department★ 72same name
- sabahattink/antigravity-fullstack-hq★ 30same name
- skateddu/claude-code-python-setup★ 28same name
- woxiangyangzhimao/skills★ 14same name
22 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository59 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- agentic-engineeringSkill
- ai-regression-testingSkill
- angularSkill
- ansibleSkill
- api-designSkill
- architecture-decision-recordsSkill
- ascend-memorySkill
- ascend-web-hunterSkill
- audio-scribeSkill
- automation-inventorySkill
- backend-patternsSkill
- bashSkill
- build-dependency-managementSkill
- code-formatterSkill
- code-reviewerSkill
- coding-standardsSkill
- dart-flutter-patternsSkill
- database-migrationsSkill
- deployment-patternsSkill
- design-systemSkill
- e2e-runbooksSkill
- e2e-testingSkill
- embedded-c-arduinoSkill
- frontend-designSkill
- g-code-3d-printingSkill
- github-opsSkill
- git-workflowSkill
- golang-patternsSkill
- hexagonal-architectureSkill
- home-assistantSkill
- java-coding-standardsSkill
- jetbrains-ide-opsSkill
- jira-integrationSkill
- keycloak-patternsSkill
- kicadSkill
- markdown-writerSkill
- mongodb-patternsSkill
- nextjs-app-router-patternsSkill
- node-backend-patternsSkill
- observability-and-loggingSkill
- obsidianSkill
- performance-optimizationSkill
- postgres-patternsSkill
- powershellSkill
- project-trackingSkill
- python-patternsSkill
- pytorch-patternsSkill
- react-patternsSkill
- researchSkill
- review-duplicationSkill
- security-reviewSkill
- seoSkill
- soap-webservicesSkill
- springboot-patternsSkill
- tdd-workflowSkill
- unitySkill
- web-accessibilitySkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 114
Never use ubuntu:latest or debian:latest as a runtime base.
- Distinctive: line 120
Create a user in the image and switch to it before the runtime stage ends.
- Distinctive: line 188
Put a database on its own network rather than relying on nobody connecting to it, and bind published ports to loopback so they are not …
- Distinctive: line 276
Verify before deploy, in the pipeline, not by hand:
- Distinctive: line 289
Keep the last 10 tagged releases, auto-delete untagged images after 7 days, and implement it as a registry lifecycle policy rather than a …
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Docker Patterns
How a container image stays small, reproducible, and safe to run: a pinned base, a build split into stages, a non-root user, no secret baked into a layer, and a scan plus a signature before it is trusted anywhere. Compose then wires those images into a local stack that behaves like the real one.
Baseline: Docker Engine 29.3 and Docker Compose v5.1 (both verified locally). The Compose v1 docker-compose
command is gone, every command below is docker compose.
When to activate
- Writing or reviewing a Dockerfile or a Compose file.
- Setting up or debugging a local multi-service development stack.
- Shrinking an image, or fixing one that rebuilds everything on every change.
- Hardening a container: user, capabilities, filesystem, secrets.
- Adding image scanning, an SBOM, or signing to a pipeline.
- Diagnosing container networking, DNS, or volume behaviour.
When not to activate
- Writing Kubernetes manifests, probes, or rollout strategy, use
deployment-patterns. - Configuring hosts rather than containers, use
ansible. - Writing the entrypoint script itself, use
bashorpowershell. - Instrumenting the application inside the container, use
observability-and-logging. - Reviewing the application's own authentication or input handling, use
security-review.
Named volumes only
An anonymous volume (- /app/node_modules) gets a random hash for a name. Nothing can back it up, target it,
inspect it, or share it, and it survives docker compose down as a dangling volume consuming disk invisibly. In
production it ties data to a container lifecycle instead of a managed resource.
Pass:
volumes:
- node_modules:/app/node_modulesFail:
volumes:
- /app/node_modulesBuild in stages, ship the last one
A multi-stage build keeps compilers, dev dependencies, and build caches out of the shipped image. Copy dependency manifests before source so a code change does not invalidate the dependency layer.
Pass:
COPY package.json package-lock.json ./
RUN npm ci
COPY . .Fail:
COPY . .
RUN npm ciFull reference Dockerfiles for Node, Go, and Python, plus the apt-get, OCI label, and build-secret rules, are in references/dockerfiles.md.
Pin the base image
:latest makes a build unreproducible and silently changes the runtime under you. Pin a specific tag, and pin a
digest where the registry supports it.
Pass:
FROM node:24.11-alpine3.23Fail:
FROM node:latestPick the smallest base that can actually run the artefact:
| Workload | Preferred base |
| Compiled binaries (Go, Rust) | gcr.io/distroless/static-debian13:nonroot or scratch |
| JVM (Spring Boot) | gcr.io/distroless/java21-debian13:nonroot |
| Node.js | node:24.11-alpine3.23 |
| Python | python:3.14-slim |
Distroless publishes no version tags, only latest, nonroot and their debug variants, so its pin is the Debian
suffix in the name plus a digest.
Never use ubuntu:latest or debian:latest as a runtime base.
Run as a non-root user
Create a user in the image and switch to it before the runtime stage ends. A container escape from root is a host compromise, from an unprivileged user it usually is not.
Pass:
RUN addgroup -g 1001 -S appgroup && adduser -S appuser -u 1001
USER appuserFail:
CMD ["node", "dist/server.js"]Harden the runtime from Compose as well, dropping every capability and adding back only what the process genuinely needs:
services:
app:
security_opt:
- no-new-privileges:true
read_only: true
tmpfs:
- /tmp
- /app/.cache
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICENET_BIND_SERVICE is only needed when the process binds a port below 1024. Listen on a high port and drop it too.
No secret in an image or a compose file
Inject secrets at runtime through the environment or a Docker secret. Anything set with ENV or ARG is readable
from the image history by anyone who can pull it.
Pass:
services:
app:
env_file:
- .env
environment:
- API_KEYFail:
ENV API_KEY=sk-proj-xxxxx- API_KEY with no value inherits the variable from the host environment, so the value never enters a committed
file. .env is gitignored. For build-time credentials use --mount=type=secret, covered in
references/dockerfiles.md.
Isolate what should not be reachable
Put a database on its own network rather than relying on nobody connecting to it, and bind published ports to loopback so they are not exposed to the host's network.
Pass:
services:
db:
ports:
- "127.0.0.1:5432:5432"
networks:
- backend-netFail:
services:
db:
ports:
- "5432:5432"Omit ports on internal services in production entirely. Compose service names resolve inside the network, so
nothing needs a published port to talk to them.
.dockerignore
Without one, the whole working tree goes into the build context, which slows every build and risks copying .env
and .git into a layer. Create it next to the Dockerfile.
Pass:
node_modules
dist
build
*.log
.git
.gitignore
.env
.env.*
coverage
**/*.test.ts
**/*.spec.ts
tests/Fail:
node_modulesSupply chain: scan, bill of materials, signature
This section is canonical for the repository. Other skills point here rather than restating it.
Scan every image in CI before it is pushed, and fail the build on a fixable critical or high finding:
trivy image --exit-code 1 --severity CRITICAL,HIGH myimage:tagStore the scan report as a CI artifact, so a later question about what was known at release time has an answer.
Generate a Software Bill of Materials after push:
syft myimage:tag -o cyclonedx-json > sbom.jsonAttach it to the pushed image as a signed attestation, so the SBOM travels with the image in the registry:
cosign attest --key cosign.key --type cyclonedx --predicate sbom.json myregistry/myimage:tagSign every production image after push:
cosign sign --key cosign.key myregistry/myimage:tagVerify before deploy, in the pipeline, not by hand:
cosign verify --key cosign.pub myregistry/myimage:tagA signature nothing verifies proves nothing. The verify step belongs in the deploy job, gating it, and a cluster policy should reject an unsigned image outright.
Registry retention
Keep the last 10 tagged releases, auto-delete untagged images after 7 days, and implement it as a registry lifecycle policy rather than a cleanup script somebody remembers to run.
Pass:
ECR lifecycle policy: keep 10 images tagged with prefix "v", expire untagged after 7 days.Fail:
docker system prune -aReference files
| Open this | For |
| references/dockerfiles.md | Full multi-stage Dockerfiles for Node, Go and Python, plus apt-get layering, OCI labels, and build-time secrets |
| references/compose-and-debugging.md | A complete local stack, override files, network isolation, volume strategies, and the commands for debugging containers and networking |
Related skills
deployment-patternsfor Kubernetes, rollout strategy, and the pipeline these images move through.observability-and-loggingfor the health, readiness, and log output the container emits.bashandpowershellfor entrypoint and healthcheck scripts.ansiblefor configuring the hosts the daemon runs on.security-reviewbefore shipping an image that handles credentials or faces the internet.
Checklist
- Every base image pinned to a specific tag, never
:latest. - Build split into stages, dependency manifests copied before source.
- Runtime stage runs as a created non-root user.
HEALTHCHECKdeclared..dockerignorepresent next to the Dockerfile and excludes.git,.env, and tests.- No secret in
ENV,ARG, or a committed compose file. - Named volumes only, no anonymous volume anywhere.
- Internal services on their own network, published ports bound to loopback or omitted.
cap_drop: [ALL],no-new-privileges, and a read-only root filesystem where the process allows it.- Trivy scan gates the push, the report is archived, and an SBOM is generated and attested to the image.
- Production images are signed and the signature is verified by the deploy job.
- Registry retention enforced by a lifecycle policy.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

