docker
Skill0 starsChanged 31 days agoMITView on GitHub
Write, review, and fix Dockerfiles, Compose files, and container build configurations. Use when the user asks to write a Dockerfile, containerize an app, fix a slow build, reduce image size, write a docker-compose.yml, set up a multi-service stack, add a healthcheck, fix a build error, or debug a container that won't start.
- Reads credentials
- Deletes or force-pushes
- Installs packages
55 other projects use a version of this.
Adopted by
Most recently taken up by
- codewithmukesh/dotnet-claude-kittheir own version, first seen Nov 8, 2026
- fmind/dottheir own version, first seen Nov 8, 2026
- fmind/dotfilestheir own version, first seen Nov 8, 2026
- ericwood8/skillstheir own version, first seen Nov 1, 2026
- turkeryildirim/ai-skillstheir own version, first seen Nov 1, 2026
- ecosyste-ms/claude-plugintheir own version, first seen Oct 25, 2026
Used with
Projects with it also use ml-training-recipe, replication and 9 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.
getcompanion-aiSkillml-training-recipe
Find implementable ML training recipes from papers, datasets, docs, and code. Use when the user wants to fine-tune, train, reproduce, or choose a practical ML method, dataset, hyperparameter setup, or benchmark recipe.
Also in 3 projects that use this
getcompanion-aiSkillreplication
Plan a replication of a paper, claim, or benchmark, and execute only after an explicit environment choice. Use when the user asks to replicate results, reproduce an experiment, verify a claim empirically, or build a replication package.
Also in 3 projects that use this
Sorcha-PlatformSkillscalar
Generates and configures Scalar OpenAPI UI for API documentation. Use when: Adding API documentation to services, configuring OpenAPI endpoints, customizing documentation themes
Also in 3 projects that use this
brainbytes-devSkillalpha-research
Also in 3 projects that use this
JaimeParkerSkillpaper-code-audit
Perform three-way cross-validation of a research paper by comparing the original paper text (via Zotero), official code implementation (via Git), and personal Obsidian notes. Use this skill whenever the user wants to "audit a paper", "verify paper claims against code", "cross-check notes with implementation", "triangulate paper + code + notes", "find discrepancies between paper and code", or mentions wanting a deep, structured comparison of a paper's claims against its implementation and their own notes. Also trigger when the user asks to "analyze this paper thoroughly" with code available, or when they want to systematically reconcile what the paper says, what the code does, and what their notes claim.
Also in 3 projects that use this
Sorcha-PlatformSkillredis
Implements Redis caching, session management, and distributed coordination for the Sorcha platform. Use when: Adding caching layers, token revocation, rate limiting, SignalR backplane, or distributed state.
Also in 5 projects that use this
- +1 more from getcompanion-ai
Other versions55 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 55
- advaitpaliwal/feynman★ 10ksame name
- companion-inc/feynman★ 10ksame name
- getcompanion-ai/feynman★ 10ksame name
- codewithmukesh/dotnet-claude-kit★ 808same name
- TheDecipherist/claude-code-mastery-project-starter-kit★ 337same name
- Mindrally/skills★ 275same name
- Resgrid/Core★ 238same name
- kid-sid/claude-spellbook★ 190same name
- OpenHands/extensions★ 167same name
- avibebuilder/claude-prime★ 119same name
45 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 repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- accessibilitySkill
- api-designSkill
- api-versioningSkill
- authSkill
- background-jobsSkill
- cachingSkill
- capacity-planningSkill
- changelogSkill
- chaos-engineeringSkill
- ci-cdSkill
- circuit-breakerSkill
- claude-best-practicesSkill
- code-commentsSkill
- code-hygieneSkill
- code-reviewSkill
- code-structureSkill
- commit-styleSkill
- concurrency-and-lockingSkill
- database-transactionsSkill
- data-consistencySkill
- debug-infra-startupSkill
- debug-sessionSkill
- demo-video-creatorSkill
- demo-video-script-creatorSkill
- dependency-injectionSkill
- dependency-updateSkill
- disk-cleanupSkill
- distributed-tracingSkill
- env-configSkill
- env-setupSkill
- error-handlingSkill
- event-driven-architectureSkill
- feature-flagsSkill
- file-storageSkill
- graceful-shutdownSkill
- idempotencySkill
- input-validationSkill
- jars-engineering-blogsmithSkill
- jars-workshop-builderSkill
- licensingSkill
- loggingSkill
- memory-and-allocationsSkill
- migrate-dbSkill
- monitoringSkill
- multi-tenancySkill
- notificationsSkill
- openapiSkill
- paginationSkill
- perf-profileSkill
- pr-descriptionSkill
- query-optimizationSkill
- rate-limitingSkill
- refactorSkill
- releaseSkill
- runbook-writerSkill
- searchSkill
- secrets-auditSkill
- simplifySkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 7 are distinctive, and 8 are very specific to this project.
0
Common
Most of the 47 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Write Dockerfiles and Compose files that build correctly, stay small, use layer caching well, and don't leak secrets or run as root.
- Very specific: line 13
Read the project first: Check the runtime, package manager, build tool, and port before writing a single line.
- Very specific: line 19
Never run as root in production images: Create a non-root user and switch to it before the final CMD.
- Very specific: line 21
Respect the repo's existing Docker setup: If a Dockerfile already exists, read it before replacing it.
- Very specific: line 62
Prefer slim / distroless for production.
- Very specific: line 64
Check the project's required version exactly: node:22-bookworm-slim not node:slim.
- Distinctive: line 68
Always use multi-stage for compiled languages and for Node/Python apps where dev dependencies must not ship to production.
- Very specific: line 125
Always create or update .dockerignore to exclude:
- Distinctive: line 158
If the app writes files (uploads, logs, SQLite), ensure the target directory is owned by the app user before switching:
- Very specific: line 181
Never use CMD node dist/server.js (shell form) — the shell becomes PID 1 and swallows signals.
- Distinctive: line 186
Add a healthcheck so Docker and Compose know when the service is actually ready:
- Distinctive: line 204
Use Compose for local development and multi-service stacks.
- Very specific: line 245
Never hardcode passwords in docker-compose.yml for anything beyond local dev.
- Distinctive: line 251
Keep dev-only config out of the production Compose file:
- Distinctive: line 287
Check the final image size and layer breakdown:
“Common” is measured: kept by at least 6 in 10 of the 47 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
Write Dockerfiles and Compose files that build correctly, stay small, use layer caching well, and don't leak secrets or run as root.
Ground rules
- Read the project first. Check the runtime, package manager, build tool, and port before writing a single line. A Node.js app and a Python app need different base images, install steps, and signal handling.
- Never copy secrets into the image. No
.envfiles, no API keys, no credentials inCOPY,ENV, orARGthat end up in the final layer. Use runtime environment variables or secrets mounts. - Never run as root in production images. Create a non-root user and switch to it
before the final
CMD. - Respect the repo's existing Docker setup. If a
Dockerfilealready exists, read it before replacing it. - Never push, publish, or deploy unless the user explicitly asks for that action.
Step 0: Read the project
Before writing anything:
# What runtime and version does the project need?
cat .nvmrc || cat .node-version || cat .python-version || cat .tool-versions
# What does the build/start look like?
cat package.json | grep -E '"scripts"' -A 10 # Node
cat pyproject.toml | grep -E 'build|start' # Python
cat Makefile | head -30
# Does a Dockerfile already exist?
ls -la Dockerfile* docker-compose* .dockerignoreNote: the runtime version, the build command, the start command, the port the app listens on, and whether there are any native dependencies that need system packages.
Writing a Dockerfile
Use the right base image
| Stack | Development | Production |
| Node.js | node:<version>-bookworm | node:<version>-bookworm-slim |
| Python | python:<version>-bookworm | python:<version>-slim-bookworm |
| Go | golang:<version>-bookworm | gcr.io/distroless/static-debian12 |
| Java | eclipse-temurin:<version>-jdk | eclipse-temurin:<version>-jre-jammy |
| Static binary | — | scratch or gcr.io/distroless/static |
- Pin the version tag. Never use
latest— it breaks reproducible builds. - Prefer
slim/distrolessfor production. They have fewer CVEs and smaller attack surface. - Check the project's required version exactly:
node:22-bookworm-slimnotnode:slim.
Multi-stage builds
Always use multi-stage for compiled languages and for Node/Python apps where dev dependencies must not ship to production.
# ── Stage 1: build ──────────────────────────────────────────────
FROM node:22-bookworm-slim AS builder
WORKDIR /app
# Copy manifests first — cached as long as deps don't change
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts
COPY . .
RUN npm run build
# ── Stage 2: production ─────────────────────────────────────────
FROM node:22-bookworm-slim AS production
WORKDIR /app
# Install only production deps in the final stage
COPY package.json package-lock.json ./
RUN npm ci --omit=dev --ignore-scripts
# Copy the built output from the builder stage
COPY --from=builder /app/dist ./dist
# Non-root user
RUN addgroup --system --gid 1001 appgroup && \
adduser --system --uid 1001 --ingroup appgroup appuser
USER appuser
EXPOSE 3000
CMD ["node", "dist/server.js"]Layer caching: the most important optimisation
Docker rebuilds every layer after the first changed layer. Dependency installs are slow —
put them before COPY . .:
# WRONG: invalidates the npm install on every code change
COPY . .
RUN npm ci
# CORRECT: npm install is cached until package.json changes
COPY package.json package-lock.json ./
RUN npm ci
COPY . .The pattern: copy manifests → install → copy source → build.
.dockerignore
Always create or update .dockerignore to exclude:
.git
.env
.env.*
node_modules
__pycache__
*.pyc
dist
build
.pytest_cache
.coverage
*.log
README.mdWithout .dockerignore, COPY . . sends node_modules (potentially hundreds of MB)
and .env (secrets) into the build context.
Non-root user
# Debian/Ubuntu-based images
RUN addgroup --system --gid 1001 appgroup && \
adduser --system --uid 1001 --ingroup appgroup appuser
USER appuser
# Alpine-based images
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuserIf the app writes files (uploads, logs, SQLite), ensure the target directory is owned by the app user before switching:
RUN mkdir -p /app/data && chown appuser:appgroup /app/data
USER appuserSignal handling and PID 1
Node and Python do not handle SIGTERM correctly as PID 1. Use tini or the exec form
of CMD to ensure clean shutdown:
# Option A: tini (explicit, works everywhere)
RUN apt-get install -y --no-install-recommends tini
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["node", "dist/server.js"]
# Option B: exec form directly (works when the process handles signals itself)
CMD ["node", "dist/server.js"] # exec form — NOT ["sh", "-c", "node dist/server.js"]Never use CMD node dist/server.js (shell form) — the shell becomes PID 1 and swallows
signals.
Healthcheck
Add a healthcheck so Docker and Compose know when the service is actually ready:
HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=3 \
CMD node -e "require('http').get('http://localhost:3000/health', r => process.exit(r.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"For distroless or minimal images with no shell, use exec form:
HEALTHCHECK --interval=10s --timeout=5s --start-period=15s --retries=3 \
CMD ["/usr/bin/grpc_health_probe", "-addr=:50051"]Writing a docker-compose.yml
Use Compose for local development and multi-service stacks. Use explicit service names, pinned image versions, and health-gated dependencies.
services:
app:
build:
context: .
target: production # target the prod stage, not the builder
ports:
- "3000:3000"
environment:
- NODE_ENV=production
- DATABASE_URL=postgresql://postgres:postgres@db:5432/myapp
depends_on:
db:
condition: service_healthy # wait for the real healthcheck, not just "started"
restart: unless-stopped
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: myapp
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
volumes:
postgres_data:Key rules:
depends_on: condition: service_healthy— not justdepends_on: db. Without the condition, Compose starts the dependent before the database is ready to accept connections.- Never hardcode passwords in
docker-compose.ymlfor anything beyond local dev. Usedocker-compose.override.ymlor a.envfile that is in.gitignore. - Pin image versions:
postgres:16-alpine, notpostgres:latest.
Development override
Keep dev-only config out of the production Compose file:
# docker-compose.override.yml (loaded automatically in dev, not in CI)
services:
app:
build:
target: builder # use the dev stage with hot reload
volumes:
- .:/app # mount source for live reload
- /app/node_modules # anonymous volume to prevent host modules overwriting container's
environment:
- NODE_ENV=development
command: npm run devReducing image size
- Use multi-stage builds — build tooling stays in the builder stage.
- Use slim or distroless base images —
node:22-bookworm-slimis ~200MB vs ~1GB fornode:22. - Combine RUN commands to avoid intermediate layers with leftover apt cache:
# WRONG: leaves apt cache in a layer RUN apt-get update RUN apt-get install -y curl # CORRECT: clean up in the same layer RUN apt-get update && \ apt-get install -y --no-install-recommends curl && \ rm -rf /var/lib/apt/lists/* - Use
--no-install-recommendswith apt to skip optional packages. - Don't install dev tools in the production stage — debuggers, compilers, test runners.
Check the final image size and layer breakdown:
docker build -t myapp .
docker images myapp
docker history myapp # layer-by-layer size breakdownDebugging build failures
Build fails during package install
# Run the failing RUN step interactively to see the real error
docker run --rm -it <base-image> bash
# then run the install command manuallyBuild produces wrong output
# Inspect the builder stage specifically
docker build --target builder -t myapp-debug .
docker run --rm -it myapp-debug bash
ls dist/ # did the build output land where you expected?Container exits immediately
docker run --rm myapp # run without -d to see output
docker logs <container-id> # if it was already started
docker inspect <container-id> # check exit code and OOMKilledContainer starts but app misbehaves
# Check what's actually running inside
docker exec -it <container> sh # or bash if available
env # are environment variables set correctly?
ps aux # is the process actually running?Common mistakes
| Mistake | Fix |
COPY . . before npm install | Copy manifests first, install, then copy source |
latest tag on base image | Pin the exact version: node:22-bookworm-slim |
.env not in .dockerignore | Add .env* to .dockerignore |
| Running as root | Add a non-root user, USER appuser before CMD |
Shell form CMD: CMD npm start | Exec form: CMD ["node", "dist/server.js"] |
depends_on: db without condition | Add condition: service_healthy |
| apt cache left in layer | rm -rf /var/lib/apt/lists/* in the same RUN |
| Dev dependencies in production image | Use multi-stage, npm ci --omit=dev in final stage |
Secrets in ENV or ARG | Use runtime env vars or --secret mounts |
Checklist before finishing
- Base image version is pinned, not
latest - Multi-stage build separates build tooling from the runtime image
COPYof manifests comes before dependency install.dockerignoreexcludes.env,node_modules,.git, build output- No secrets in
ENV,ARG, orCOPY - Non-root user created and active before
CMD CMDuses exec form, not shell form- Healthcheck defined with a real probe (not just
CMD true) docker buildruns without errordocker runstarts the container and the app responds on the expected port- For Compose:
depends_onusescondition: service_healthywhere needed
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.

