Review a Dockerfile
Reviews a Dockerfile for security, image size, build cache use and runtime correctness, and returns ranked findings with a corrected file. Use before shipping an image, or when one is too big.
A Dockerfile decides what ships to production: which base image and its vulnerabilities, which user the process runs as, whether secrets end up in a layer, and how long every build takes. Most problems are invisible until an image is scanned, pulled at scale or stopped mid-request.
Review . If it is a path, read it, plus .dockerignore and the files it copies.
Only if [RUNTIME] is given: It runs as:
Weight your attention toward: .
Check, citing the line for each issue:
- Base image: a specific version tag (never
latest), ideally pinned by digest (leave the digest as a placeholder if you do not know it); the same family across stages. For the final stage, prefer distroless or a-slimvariant; usescratchonly for static binaries; suggest Alpine only after checking that musl will not break native modules or Python wheels (numpy, pandas, grpc and similar), and say that you checked. - Stages: build tools, compilers and dev dependencies stay in a build stage; the final stage copies only the artefacts it needs.
- Secrets: no credentials in
ARG,ENV, copied files or the build context. Build-time secrets use BuildKit secret mounts. - User: the final stage runs as a non-root user with a fixed UID, and files it does not need to write are not owned by it.
- Cache order: dependency manifests and lockfiles are copied and installed before the source, so a code change does not reinstall dependencies. Package caches use BuildKit cache mounts rather than being baked into a layer, and the final stage installs production dependencies only.
- Package installs: update and install in one
RUN, without recommended extras, with package lists removed in the same layer; lockfile-respecting install commands. .dockerignore: excludes.git, local env files, build output and dependency folders.- Runtime: exec-form
ENTRYPOINT/CMDso the process receives signals; a process that handles SIGTERM, or an init when it spawns children;HEALTHCHECKonly when the platform uses it;WORKDIRset; noADDfrom URLs and no download-and-run commands.
- Every finding cites a line and says what goes wrong in practice (attack, failure or cost), not only which rule it breaks.
- Do not quote image size or build time savings as facts. Mark them as estimates unless you built the image.
- Keep the app's behaviour the same in the revised file: exposed port, entrypoint semantics, working directory, environment variables and the paths the app reads or writes. If a fix needs information you do not have (the runtime, the start command, the writable paths), say so instead of guessing; if you cannot tell the runtime or how the app starts, ask and stop before rewriting.
- Do not add tools the original image did not need (curl, a shell) "for debugging".
- Skip style-only remarks such as instruction casing or comment wording.
- Read the relevant code before making a claim about it. Do not guess what a file, function or config contains.
- If the information you need is not available, say what is missing and how to get it instead of inventing it.
Verdict
One line: ship, ship-after-fixes or rework, with the number of findings by severity.
Findings
Numbered, most severe first: [high|medium|low] line N — problem — impact — fix.
Revised Dockerfile
The full corrected file, with a short comment on each changed line, followed by a .dockerignore block if the current one is missing or lets .git, env files or dependency folders into the context. Omit this section if there are no findings above low.
Behaviour to check
Anything the revised file changes at runtime (user, paths, init process) that the team must test. "None" if empty.
Verify
Commands to compare size and layers before and after (docker image ls, docker history), to confirm the container runs as the non-root user, and to scan the image.
Not checked
What you could not verify (base image vulnerabilities, actual image size, the app's signal handling). "None" if empty.
1 required value still a placeholder; the assistant will ask for it.
details
- kind
- Prompt: a task you run by name to get one finished thing back
- domain
- Software engineering
- category
- DevOps
- level
- Intermediate
- depth
- Specific
- made for
- DevOps / platform engineer, Software engineer, Site reliability engineer
- needs
- repo-read
- risk
- read-only
- version
- v1.1.0 · experimental
- reviewed
- 2026-10-02
- aliases
- devops-container, slim-container-image
- works in
- Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Antigravity, OpenCode, Windsurf, Zed, Continue, AGENTS.md
use in
npx @hermes-hq/hodios install review-dockerfile --target claude-codenpx skills add hermes-hq/hodios-dist --skill review-dockerfile -a claude-codeclaude plugin marketplace add hermes-hq/hodios-distclaude plugin install hodios-software-engineering@hodiosThe plugin brings every entry in this domain at once.
pairs well with
All of DevOpsWrite Kubernetes manifests
Writes production-ready Kubernetes manifests for a service with probes, resource requests, a disruption budget and a restricted security context. Use when deploying a service to a cluster.
write-kubernetes-manifestsSet up deployment for an app
Plans how an app gets from the repository to production, choosing hosting that fits, a build-test-deploy pipeline, secrets, rollback and the production basics. Use when you need to ship an app.
set-up-app-deploymentDesign a deployment strategy
Chooses and specifies a deployment strategy (rolling, blue-green, canary or feature-flagged) with health gates, automated rollback triggers and database-change ordering. Use when deploys feel risky.
design-deployment-strategyDevOps engineer
Acts as a DevOps engineer who automates the second time, keeps pipelines fast and reproducible, and makes every change reversible. Use for CI/CD, infrastructure and release work.
devops-engineerRelease track
Takes a release from change review to changelog, checklist, staged rollout, verification and announcement, pausing for approval between steps. Use for any release users will notice.
release-trackReduce cloud spend
Analyses a cloud bill or cost export alongside the architecture and ranks savings by monthly impact, effort and risk. Use when the cloud bill grows faster than usage.
reduce-cloud-spend