docker
Skill338 starsChanged 5 months agoMITView on GitHub
Production Docker best practices for writing Dockerfiles, Compose files, and Swarm stacks. Use whenever creating or editing a Dockerfile, a docker-compose / compose.yaml, or a stack file, or building and optimizing an image. Fixes the handful of things Claude reliably gets wrong: multi-stage builds, layer-cache ordering, exec-form ENTRYPOINT for correct signals and exit codes, init:true, keeping secrets and env out of the image, non-root users, and healthchecks. From production, not defaults.
- Reads credentials
- Deletes or force-pushes
- Installs packages
47 other projects use a version of this.
Adopted by
Most recently taken up by
- fmind/dottheir own version, first seen Oct 5, 2026
- Quad4-Software/skillstheir own version, first seen Oct 3, 2026
- vekzz-dev/opencode-skillstheir own version, first seen Oct 3, 2026
- fworks-tech/agenthoodtheir own version, first seen Sep 28, 2026
- iuliandita/skillstheir own version, first seen Sep 24, 2026
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
Used with
Projects with it also use ansible, kubernetes and 10 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.
KubementatSkillansible
Ansible automation reference for playbooks, roles, inventory, variables, and modules. Includes Proxmox VE and Docker integration via community.general and community.docker collections. Use when writing playbooks, troubleshooting Ansible runs, or designing automation workflows. Triggers: ansible, playbook, inventory, role, task, handler, vars, jinja2, galaxy, proxmox_kvm, proxmox_lxc, docker_container, docker_compose.
Also in 3 projects that use this
mjunaidcaSkillkubernetes
Production-grade Kubernetes manifests and debugging for containerized applications. This skill should be used when users ask to deploy to Kubernetes, create K8s manifests, containerize for K8s, set up Deployments/Services/Jobs/StatefulSets/CronJobs, create namespaces with resource quotas, set up multi-team isolation, configure ResourceQuota/ LimitRange, secure with RBAC (ServiceAccount, Role, RoleBinding), configure init containers (model download, db wait, migrations), set up sidecars (logging, metrics), or debug pods (CrashLoopBackOff, logs, exec, describe, events). Auto-detects from Dockerfile/code, generates hardened manifests with educational comments. CKAD-aligned.
Also in 6 projects that use this
mjunaidcaSkillhelm
Production-grade Helm 4 chart development, release management, and debugging. This skill should be used when users ask to create Helm charts, deploy with Helm, manage releases (install/upgrade/rollback), push charts to OCI registries, debug failed deployments, configure chart dependencies, create umbrella charts, set up GitOps with ArgoCD/Flux, or troubleshoot Helm issues. Auto-detects from Dockerfile/code, generates production-hardened charts with library patterns. Complements kubernetes skill.
Also in 3 projects that use this
LangChainSkilllangchain
Build agents with a prebuilt architecture and integrations for any model or tool. Use when creating tool-calling agents, switching model providers, or adding structured output.
Also in 3 projects that use this
diego-tobalinaSkilllogging
Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.
Also in 4 projects that use this
ihiteshguptaSkillterraform
Expert in Infrastructure as Code with Terraform. Use for creating, managing, and versioning infrastructure across cloud providers.
Also in 4 projects that use this
Other versions47 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 47
- codewithmukesh/dotnet-claude-kit★ 750same name
- nth5693/gemini-kit★ 373same name
- Mindrally/skills★ 266same name
- avibebuilder/claude-prime★ 120same name
- nahid-sparktales/agent-dispatcher★ 59same name
- kumaran-is/claude-code-onboarding★ 36same name
- neuron-one/GODMODE★ 33same name
- mjunaidca/mjs-agent-skills★ 27same name
- sordi-ai/skill-everything★ 20same name
- greedychipmunk/agent-skills★ 19same name
37 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 repository26 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- global-claude-md/CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-conventionsSkill
- code-reviewSkill
- create-serviceSkill
- css-structureSkill
- debuggerSkill
- dependency-vettingSkill
- design-reviewSkill
- dev-pitfallsSkill
- docker-swarmSkill
- mcp-builderSkill
- mdd-workflowSkill
- mongodb-backupsSkill
- mongodb-replica-setsSkill
- mongodb-rulesSkill
- nginxSkill
- nodejsSkill
- responsive-cssSkill
- schema-source-of-truthSkill
- test-writerSkill
- tui-builderSkill
- wafSkill
- web-architectureSkill
- web-performanceSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 42 edited versions we read keep these.
0
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 68
Log to stdout/stderr, not to files inside the container: Write to /dev/stdout and /dev/stderr so Docker's logging driver and your …
“Common” is measured: kept by at least 6 in 10 of the 42 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: Production Image and Compose Rules
From production, not defaults. Claude's Dockerfiles tend to be wrong in the same few ways. Fix them here.
Dockerfile
- Multi-stage builds, always. Build in a stage that has the compilers and dev dependencies, then
COPY --from=buildonly the artifacts into a slim runtime stage. The runtime image carries no build tools, which cuts size hard (a real build went from ~2GB to ~200MB) and removes a pile of CVEs.
FROM node:22 AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-slim AS runtime
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=build /app/dist ./dist
USER node
ENTRYPOINT ["node", "dist/server.js"]- Order layers by how often they change: stable first, source last. Docker caches each layer and rebuilds every layer after the first one whose inputs changed. So copy the dependency manifest and install deps BEFORE copying source:
COPY package*.json ./thenRUN npm cithenCOPY . .. Copy source first and a one-line code change reinstalls every dependency, every build. - The runtime command is
ENTRYPOINT/CMDin exec form, neverRUN.RUNexecutes at build time; the container's process belongs inENTRYPOINT ["node","server.js"](a JSON array). Use exec form, not shell form (ENTRYPOINT node server.js): shell form runs your app under/bin/sh -c, soshis PID 1, it swallowsSIGTERM, and your app never shuts down gracefully (Docker waits out the grace period then SIGKILLs it) and its exit code is lost. Exec form makes your process PID 1 so signals and exit codes propagate.ENTRYPOINTfor the executable,CMDfor default args. - Pin base image versions.
FROM node:22.3.0-slim, notnode:latest.latestmakes builds non-reproducible and shifts under you silently. Pin a tag (or a digest for full reproducibility), and expose it as anARGso it's easy to bump deliberately. - Add a
.dockerignore. Excludenode_modules,.git,.env,dist, and local junk. Without it the whole directory ships as build context (slow), busts the cache on unrelated changes, and can bake a stalenode_modulesor a secret file into the image. - Run as non-root. Containers run as root by default. Add a
USER(for exampleUSER node) before the entrypoint so a container escape isn't root on the host. - Add a
HEALTHCHECK. Swarm and Compose use it to know a container is actually ready, which is what makes rolling updates and automatic rollback work. Without it, "running" only means the process started, not that it serves traffic. - Combine and clean in one
RUN.apt-get update && apt-get install -y ... && rm -rf /var/lib/apt/lists/*in a single layer. A separateupdatelayer goes stale behind the cache, and the cleanup only shrinks the image if it happens in the same layer that added the files.
Compose and Swarm
init: trueon every service. The one always missed. It runs a tiny init (tini) as PID 1 that forwards signals to your process and reaps zombie children. Without it, signal handling and zombie reaping become your app's problem anddocker stopoften hangs to the timeout. Pair it with an exec-form ENTRYPOINT.- Set resource
limitsANDreservations. Reservations make the scheduler place the container only where the resources exist; limits cap it so a runaway container can't take down the node. Both, not one. - Configure rolling updates and rollback.
update_configwithparallelism: 1, adelay,order: stop-first(orstart-firstfor blue-green), andfailure_action: rollback. Combined with a HEALTHCHECK, a bad deploy rolls itself back instead of taking the service down. - Reference services by name, never by IP. Container IPs change on every restart, scale, and update. Use the service name and let Docker DNS resolve it (
backend-service:8080). A hardcoded IP is a guaranteed future outage. - Substitute env with defaults.
replicas: ${NGINX_REPLICAS:-2}andimage: registry/app:${BUILD_VERSION:-latest}keep one file working across environments through.env.
Secrets and config
- Never bake secrets into the image.
ARGandENVvalues are stored in image layers and show up indocker history, so a secret written into the Dockerfile is a leaked secret. Use BuildKit build secrets (RUN --mount=type=secret,id=...) for build time, and Docker secrets (mounted at/run/secrets/<name>) or runtime env for run time. Docker secrets are encrypted at rest, never appear indocker inspect, and are scoped to the services that mount them. - Secrets for sensitive, configs for the rest. Docker
secretfor certs, keys, and passwords (encrypted); Dockerconfigfor non-sensitive files like an IP blocklist (not encrypted, but versioned and injected the same way). Neither goes in the image, both are injected at deploy. - Log to stdout/stderr, not to files inside the container. Write to
/dev/stdoutand/dev/stderrso Docker's logging driver and your aggregator collect them. Logging to a file inside the container hides the output and fills the writable layer.
This skill is built to grow. Add a rule when a real Dockerfile or stack failure has a stable, defensible fix.
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.

