docker-and-containers
Skill1 starsChanged 46 days agoMITView on GitHub
Language-agnostic framework for writing, reviewing, optimizing, and securing Dockerfiles, container images, and Docker Compose configurations. Triggers whenever an agent is asked to "write a Dockerfile", "containerize this app", "review this Dockerfile", "why is my image so big?", "docker-compose setup", or "optimize Docker build". Enforces minimal base images, multi-stage builds, layer caching order, non-root user execution, HEALTHCHECK declarations, and vulnerability scanning with Trivy.
- Reads credentials
- Deletes or force-pushes
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- azhou555/claude-skillstheir own version, first seen Jul 7, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- azhou555/claude-skills★ 0same name
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 repository15 other files it gives its agents.
- accessibility-auditSkill
- agent-skills-authoringSkill
- api-designSkill
- ci-cd-pipelineSkill
- code-reviewSkill
- design-system-adapterSkill
- docs-and-adrSkill
- git-commit-workflowSkill
- package-security-vettingSkill
- replicate-apiSkill
- secrets-and-config-managementSkill
- testing-strategySkill
- ui-cloneSkill
- ui-slop-remediationSkill
- universal-coding-standardsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 4 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 29
Avoid full general-purpose OS images (ubuntu:latest, debian:latest, node:20).
- Very specific: line 30
Use minimal variants (alpine, slim, or Google distroless for compiled binaries) to minimize attack surface and reduce image transfer times.
- Distinctive: line 35
Ensure the base image receives regular CVE security patches from verified publishers.
- Distinctive: line 42
Every compiled or transpiled application (TypeScript, Go, Rust, Java, Python virtualenvs) must use multi-stage builds.
- Very specific: line 45
Use COPY --from=builder to extract only production binaries, static bundles, or pruned production dependencies.
- Distinctive: line 52
Place slow, infrequently-changing steps at the top.
- Very specific: line 74
Every repository must have a .dockerignore file excluding .git, node_modules, .env*, build outputs, and test artifacts from the Docker …
- Very specific: line 84
Never use ENV or ARG to pass production secrets during docker build.
- Very specific: line 89
Always define CPU and memory limits (mem_limit, cpus) in orchestration configs to prevent runaway processes from starving host nodes.
- Very specific: line 96
Use an init system (like dumb-init or tini) or format ENTRYPOINT in exec form (ENTRYPOINT ["node", "server.js"]) so the process runs as PID …
- Very specific: line 97
Avoid shell form (CMD npm start), which wraps the process in /bin/sh and swallows shutdown signals, forcing a slow SIGKILL timeout.
- Distinctive: line 106
Use Docker Compose primarily for local multi-container developer environments (e.g.
- Very specific: line 108
Use explicit named volumes for database storage (db_data:/var/lib/postgresql/data) to prevent data loss on container recreation.
- Very specific: line 110
Use a base docker-compose.yml with layered docker-compose.override.yml files rather than duplicating entire service configurations.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Docker & Container Engineering Standards
A language-agnostic operational standard for authoring, evaluating, and securing Dockerfiles, container images, and local multi-service container environments.
Sibling Standards:
- For managing environment variables and avoiding baking secrets into images, see
secrets-and-config-management.- For integrating container vulnerability scans and image caching into CI, see
ci-cd-pipeline.
1. Base Image Selection & Pinning
- 1.1 Prefer Minimal Official Images:
- Avoid full general-purpose OS images (
ubuntu:latest,debian:latest,node:20). - Use minimal variants (
alpine,slim, or Googledistrolessfor compiled binaries) to minimize attack surface and reduce image transfer times.
- Avoid full general-purpose OS images (
- 1.2 Pin Explicit Versions:
- 🚫 Never use
:latestin production Dockerfiles. - Pin exact versions (e.g.
node:20.18-alpine3.20orpython:3.12-slim-bookworm). For immutable reproducibility, pin the SHA-256 image digest.
- 🚫 Never use
- 1.3 Actively Maintained Repositories:
- Ensure the base image receives regular CVE security patches from verified publishers.
2. Multi-Stage Build Architecture
- 2.1 Decouple Build Tools from Runtime:
- Every compiled or transpiled application (TypeScript, Go, Rust, Java, Python virtualenvs) must use multi-stage builds.
- Compilers, SDKs, devDependencies, and test runners remain in the
builderstage and are never copied into the final production image.
- 2.2 Copy Only Built Artifacts:
- Use
COPY --from=builderto extract only production binaries, static bundles, or pruned production dependencies.
- Use
3. Layer Caching & Build Context Efficiency
- 3.1 Order Instructions by Change Frequency:
- Place slow, infrequently-changing steps at the top; frequently-changing code at the bottom:
# 1. System packages & tools (rarely changes) RUN apk add --no-cache dumb-init # 2. Dependency manifests & installation (changes weekly/monthly) COPY package.json pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile # 3. Source code copy & compilation (changes on every commit) COPY . . RUN pnpm build
- Place slow, infrequently-changing steps at the top; frequently-changing code at the bottom:
- 3.2 Combine Consecutive RUN Commands:
- Group package manager updates, installs, and cache cleanups into a single
RUNcommand to prevent bloated intermediate layers:RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ ca-certificates \ && rm -rf /var/lib/apt/lists/*
- Group package manager updates, installs, and cache cleanups into a single
- 3.3 Mandatory
.dockerignore:- Every repository must have a
.dockerignorefile excluding.git,node_modules,.env*, build outputs, and test artifacts from the Docker build context.
- Every repository must have a
4. Container Security & Isolation
- 4.1 Non-Root User Execution:
- 🚫 Never run production processes as
root! - Switch to a dedicated non-root user before the final
ENTRYPOINTorCMD(e.g.USER nodein Node,USER 10001in Python,USER nonroot:nonrootin Distroless).
- 🚫 Never run production processes as
- 4.2 Zero Baked Secrets:
- Never use
ENVorARGto pass production secrets duringdocker build. Secrets embedded in build arguments persist permanently in image layer metadata. - Inject secrets at container startup via runtime environment variables or a secrets manager.
- Never use
- 4.3 Automated Vulnerability Scanning:
- Audit images for CVEs using Trivy, Grype, or Docker Scout in CI (see
references/scanning-tools.md).
- Audit images for CVEs using Trivy, Grype, or Docker Scout in CI (see
- 4.4 Explicit Resource Constraints:
- Always define CPU and memory limits (
mem_limit,cpus) in orchestration configs to prevent runaway processes from starving host nodes.
- Always define CPU and memory limits (
5. Runtime Lifecycle & Signals
- 5.1 Proper Signal Handling (Graceful Shutdown):
- Use an init system (like
dumb-initortini) or formatENTRYPOINTin exec form (ENTRYPOINT ["node", "server.js"]) so the process runs as PID 1 and receivesSIGTERMsignals for graceful termination. - Avoid shell form (
CMD npm start), which wraps the process in/bin/shand swallows shutdown signals, forcing a slowSIGKILLtimeout.
- Use an init system (like
- 5.2 Declare a Healthcheck:
- Define an explicit
HEALTHCHECKdirective so orchestrators and Docker Desktop can monitor application availability.
- Define an explicit
6. Docker Compose Standards (Local Development)
- 6.1 Development Scoping:
- Use Docker Compose primarily for local multi-container developer environments (e.g. app + PostgreSQL + Redis), not as a raw production deployment mechanism.
- 6.2 Named Volumes for Persistence:
- Use explicit named volumes for database storage (
db_data:/var/lib/postgresql/data) to prevent data loss on container recreation.
- Use explicit named volumes for database storage (
- 6.3 Layered Overrides:
- Use a base
docker-compose.ymlwith layereddocker-compose.override.ymlfiles rather than duplicating entire service configurations.
- Use a base
Detailed References
references/dockerfile-examples.md: Production-ready multi-stage Dockerfiles and.dockerignoretemplates for Node.js (pnpm + Alpine), Python (uv + Slim), and Go (Static Binary + Distroless).references/scanning-tools.md: Setup, CLI usage, and CI integration guides for Trivy, Grype, and Docker Scout.
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.

