Dockerfile Linter
Paste a Dockerfile and get quick feedback on common mistakes.
What it checks
The linter flags images using the latest tag or no tag, ADD where COPY is usually better, apt-get install without --no-install-recommends, a missing USER (the container runs as root) and a missing WORKDIR.
Warnings and info
Results are marked WARN or INFO with the line number where it applies. Treat them as guidance rather than hard rules.
How to use it
- Paste your Dockerfile into the box.
- Press Lint.
- Review the results and fix what applies to you.
Example
This Dockerfile:
FROM node:latest ADD . /app RUN apt-get install curl CMD npm start
produces warnings for the latest tag and for running as root, and info notes about ADD, install flags and WORKDIR.
Common use cases
- Reviewing a Dockerfile before building an image.
- Teaching teams common container best practices.
- Spotting images that run as root.
The exact rules and how they match
The linter reads your file line by line, skips blank lines and comments, and applies simple pattern checks. The results below are everything it can report:
- ERROR if no
FROMline exists at all. - WARN on a
FROMline that contains:latestor no colon, for exampleFROM node. The check is on the whole line, soFROM node AS buildis flagged too. - WARN if no
USERinstruction appears anywhere. - INFO for
ADDwithout an http(s) URL, forRUNlines that containapt-get installwithout--no-install-recommends, for the exact lineCOPY . ., and whenWORKDIRis missing. - WARN for an
EXPOSEwith no port.
Instruction names are matched case-insensitively for most rules. If every rule passes the output is a green tick and the words No issues found.
Cases it will miss
Because it uses line patterns rather than a real Dockerfile parser, it has blind spots you should know about before trusting a clean result:
- Multi-line commands. In a
RUN apt-get update && \followed byapt-get install -y curlon the next line, the install is not on a line starting withRUN, so the flag check never fires. - Registry ports.
FROM localhost:5000/appcontains a colon, so an untagged image there is not flagged. - Digest pins such as
FROM node@sha256:...contain a colon and pass, which is correct, since a digest is the strongest pin. - Multi-stage builds. A
USERorWORKDIRin any stage satisfies the whole file, even if the final stage runs as root. - COPY flags.
COPY --chown=app . .is not matched by theCOPY . .note.
It also does not check layer ordering, pinned package versions, HEALTHCHECK, secrets in ENV or ARG, or shell form versus exec form of CMD. For a deeper check use hadolint, which implements many more rules.
Fixing the common findings
A tag warning is fixed by pinning, for example FROM node:20-alpine. Pin to a minor version if you want patches, or a digest if you need exact reproducibility. For the root-user warning, create a user near the end: RUN adduser -D app then USER app, and make sure files the app writes are owned by it. Put the install flag in as apt-get install -y --no-install-recommends curl, and clean up with rm -rf /var/lib/apt/lists/* in the same RUN so the cache never lands in a layer.
If the linter flags COPY . ., it is a reminder to add a .dockerignore listing .git, node_modules and local .env files, which stops secrets and large folders from entering the build context.
Frequently asked questions
Why avoid the latest tag?
It can change underneath you, making builds hard to reproduce.
Why not use ADD?
COPY is explicit; ADD also fetches URLs and extracts archives, which can surprise you.
Is this a complete security scan?
No. It checks a few common issues, not vulnerabilities in the image.
Is my data uploaded?
No. This tool runs entirely in your browser, so what you type or paste is not sent to our servers.
Does it support multi-stage Dockerfiles?
It reads every FROM line, but USER and WORKDIR checks apply to the whole file, so a missing USER in the final stage can go unnoticed if an earlier stage sets one.
Why was FROM node AS build flagged?
The line has no colon, so the linter sees an untagged image. Write FROM node:20-alpine AS build to clear the warning.