dockerfile-audit
Skill0 starsChanged 4 days agoMITView on GitHub
The skill audits Dockerfiles for base-image pinning, non-root execution, package-layer hygiene, copy order, ADD misuse, health checks and secret-bearing build arguments; use it to harden a container image before release.
- Installs packages
In this repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- api-design-reviewSkill
- codebase-reviewSkill
- commit-and-dcoSkill
- django-app-scaffoldSkill
- exhaustive-prompt-specSkill
- incident-postmortemSkill
- log-triageSkill
- pr-review-tableSkill
- react-component-specSkill
- readme-writerSkill
- repo-polishSkill
- runbook-writerSkill
- security-reviewSkill
- spring-boot-endpointSkill
- test-plan-writerSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 4 are distinctive, and 3 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.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Use this skill when asked to audit, lint, harden, or review a Dockerfile or container build file for security and reproducibility.
- Distinctive: line 24
Read the complete Dockerfile and preserve its original line numbering.
- Very specific: line 26
Check for a non-root USER instruction and flag its absence.
- Very specific: line 31
Run python3 skills/dockerfile-audit/scripts/lint_dockerfile.py Dockerfile and capture its exact stdout and exit code.
- Distinctive: line 49
Do not infer that a base tag is immutable.
- Distinctive: line 50
Do not expose secret values in findings.
- Very specific: line 51
Do not treat a build-stage USER as proof that the final image is non-root.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Purpose
Find concrete Dockerfile risks and report each finding with a deterministic rule identifier.
When to use
Use this skill when asked to audit, lint, harden, or review a Dockerfile or container build file for security and reproducibility.
Inputs needed
- The complete Dockerfile content or a readable file path.
- The intended runtime user only when a specific non-root account name is required.
Step-by-step procedure
- Read the complete Dockerfile and preserve its original line numbering.
- Identify every
FROMinstruction and flag an omitted tag,latest, or a mutable unpinned tag. - Check for a non-root
USERinstruction and flag its absence. - Inspect each
apt-get installlayer for--no-install-recommendsand removal of/var/lib/apt/lists/*in that same layer. - Compare broad
COPY .orCOPY ./instructions with dependency-manifest copies and flag context copies that occur first. - Flag
ADDwhen it is used for local files rather than archive extraction or a remote source with a documented reason. - Flag a missing
HEALTHCHECKand secret-like values supplied throughENVorARG. - Run
python3 skills/dockerfile-audit/scripts/lint_dockerfile.py Dockerfileand capture its exact stdout and exit code.
Exact output format
Return one row per finding as line:rule:message, sorted by ascending line number and then rule identifier. Do not add prose. A clean file produces No findings. and exit code zero.
Edge cases
- A multi-stage Dockerfile needs a non-root runtime user in the final stage; a build-stage user does not satisfy the check.
- A pinned digest is accepted even if the tag is descriptive.
- Shell-form
RUNcommands are examined only for the specified package-manager rules. - A
HEALTHCHECK NONEis still an explicit health-check disablement and must be reported for a service image.
Do not
- Do not infer that a base tag is immutable.
- Do not expose secret values in findings.
- Do not treat a build-stage
USERas proof that the final image is non-root.
Worked example summary
A multi-stage Node image copies the build context before package.json, uses an unpinned base tag, installs apt packages without cleanup, and omits a runtime user and health check. The linter emits one deterministic finding for each applicable rule.
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.

