Dockerfile review with fixes
Flags latest tags, running as root, apt without cleanup, COPY . before dependency installs, secrets in ENV/ARG and missing HEALTHCHECK, with line numbers, reasons and fixes.
What it does
Statically checks a Dockerfile for security, image size, reproducibility and cache problems, with line numbers.
FROMwithout a tag or with:latest(digest pins and ARG defaults are taken into account)- Final stage running as root (no
USER, or lastUSERis root) apt-getwithout cleanup,updateandinstallin separate RUNs, missing-yor--no-install-recommends,apk addwithout--no-cache, pip cache left in the layerCOPY . .before installing dependencies, which defeats layer caching- Secret-looking names in
ENV/ARG, inline credentials in RUN, COPY of.envor key files - Missing
HEALTHCHECK, duplicate or shell-formCMD/ENTRYPOINT,ADDfrom URLs, piping curl into sh,sudo,chmod 777,EXPOSE 22, relativeWORKDIR, missing.dockerignoreand more - Handles multi-stage builds, line continuations,
# escape=andRUN <<EOFheredocs
How to use
python scripts/dockerfile_lint.py Dockerfile --json dockerfile-review.json
The agent confirms each finding in context (does the base image already set a non-root user, is it deployed on Kubernetes, and so on) and proposes a corrected Dockerfile or diff.
Requirements
- Python 3 (standard library only). Docker itself is not required.
Caveats
- Static checks only: no image pulls or builds, so the base image contents are not inspected.
- Heuristic rules can misfire on unusual syntax.
- If an already pushed image contained a secret, fixing the Dockerfile is not enough: rotate the secret.
How to install
- Unzip the downloaded file (it contains a
dockerfile-review/folder withSKILL.md). - Copy the whole folder into your agent's skills folder.
- Claude:
~/.claude/skills/(per project:.claude/skills/) - Hermes Agent:
~/.hermes/skills/ - Codex:
~/.agents/skills// Cursor:~/.cursor/skills/ - Claude app (claude.ai): upload the ZIP in Customize → Skills
- Claude:
- Restart the agent and check that the skill appears in its skill list.
Seller
AI Skill Market (official)
44 published skills