- Home
- Skills
- DevOps & Cloud
- Dockerfile and Compose Audit
Works with the AI Agents you already use
Dockerfile and Compose Audit
Finds unpinned images, root users, secrets in ENV, privileged containers and exposed database ports, with a fix for each.
$5
Dockerfile and Compose Audit
Example session with this skill installed
/dockerfile-audit Dockerfile
- Read your context and instructions
- Compiled the dockerfile and compose
Illustrative. The Dockerfile is invented (the token in it is not a real one); the report below is what the script prints for it. Secret values are hidden.
DOCKER AUDIT (1 file(s): 1 high, 4 medium, 7 info)
examples/bad/Dockerfile [dockerfile]
HIGH line 4 secret-in-image-metadata
ENV API_TOKEN=<value hidden>
why: A value set here is stored in the image layers and shown by the image history, so anyone who can pull the image can read it.
better: Pass secrets at run time (environment from your orchestrator or a secret mount), or use a build secret mount for build-time needs.
MEDIUM line 1 unpinned-base-image
FROM node
why: A base image with no tag, or the latest tag, changes without notice, so the same Dockerfile builds different images over time.
better: Pin a version tag (for example python:3.12-slim), and a digest if you need exact repeatability.
MEDIUM line 1 runs-as-root
FROM node (last stage)
why: The container runs as the administrator account unless a USER line says otherwise, so a flaw in the app gives wide access.
better: Create a non-administrator user and switch to it with USER before the final command.
MEDIUM line 7 apt-update-alone
RUN apt-get update
why: An update on its own layer is cached, so a later install can use a stale package list and fail or install old versions.
better: Run update and install in the same RUN instruction.
MEDIUM line 11 expose-ssh
EXPOSE 22 8080
why: Port 22 suggests an SSH server inside the container, which is rarely needed and widens the attack surface.
better: Use the container runtime's own exec or a debug sidecar instead of running SSH in the image.
INFO line 1 no-healthcheck
FROM node (last stage)
why: A service with no health check cannot tell the platform when it is broken.
better: Add a HEALTHCHECK, or define the check in your orchestrator.
INFO line 1 no-digest
(whole file)
why: Images are pinned by tag only; a tag can be moved by the registry owner.
better: For exact repeatability, pin by digest (image@sha256:...) and update it on purpose.
INFO line 5 cache-order
COPY . ...
why: Everything is copied before dependencies are installed, so any source change re-runs the install step.
better: Copy only the dependency manifest first, install, then copy the rest.
INFO line 8 apt-recommends
RUN apt-get install -y curl git
why: Recommended packages are installed too, which makes the image larger.
better: Add --no-install-recommends and list what you need.
INFO line 8 apt-lists-left
RUN apt-get install -y curl git
why: The package lists stay in the layer and add size.
better: End the same RUN by removing /var/lib/apt/lists.
INFO line 9 add-instead-of-copy
ADD config.yaml /app/config.yaml
why: ADD can unpack archives and fetch URLs, which surprises people. For plain files COPY says what it does.
better: Use COPY for local files.
INFO line 10 pip-cache
RUN pip install flask
why: pip keeps a download cache in the layer and adds size.
better: Add --no-cache-dir, or set PIP_NO_CACHE_DIR=1.
Limits: this reads the text of the files. It does not build the image, so it cannot see what a base image contains, what a build argument is set to, or which user the base image already uses. Values of variables named like secrets are hidden, but other instruction lines are echoed (up to 110 characters), so a token typed inside a RUN line can appear in the report. A clean report is not a security review.
Next steps
- Fix the high finding first and treat that token as exposed if it was ever real.
- Work through the medium findings, then the size and speed notes, using the reference file for each rule.
Connects securely to your tools. The creator never sees your data.
About this skill
Audit the Docker files in a repository before they reach a registry. Point it at one Dockerfile, one Compose file or a whole folder and it checks 22 rules: unpinned base images, a container that runs as the default administrator account, secrets set with ENV or ARG, a downloaded script piped into a shell, package-install habits that bloat the image (apt and pip), a copy order that breaks the build cache, a missing health check and an exposed SSH port; and in Compose files, unpinned images, privileged containers, host networking, the Docker control file (docker.sock) mounted into a container, literal secrets and database ports published on every interface. Each finding gives the file, the line, why it matters and a better pattern, ordered high, medium, info. A reference file says what to check for each rule and when a finding can be fine.
What it reads and writes: only the Dockerfile, Compose file or folder you name; it writes nothing. It never builds an image, never runs a container and never contacts a registry. No network connection, no environment variables, nothing to install, and Docker does not need to be installed. Values of variables named like secrets are hidden in the report.
Honest limits: it reads text. It cannot see what a base image contains, which user the base image already runs as, what a build argument is set to or how the container is started in production, so a finding can be a false alarm and a clean report is not a security review. Other instruction lines are echoed up to 110 characters, so a token typed inside a RUN line can appear in the report; treat any secret that shows up as exposed. Needs Python 3.9+.
Needs Python 3.9+. Reads text only: it cannot see base image contents, the user a base image runs as, build argument values or production runtime. A finding can be a false alarm and a clean report is not a security review.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 15 days ago
Requires
Permissions
File Scopes
Reads only the files or folder you name; it never builds an image, never runs a container, makes no network connection and reads no environment variables. Words such as docker.sock, privileged and password appear in the code as patterns it reports.