What does a Dockerfile linter do?
A Dockerfile can build and still be a bad Dockerfile. It runs as root, it uses the latest tag so tomorrow's build differs from today's, it leaves the apt cache inside the image, it writes a password in an ENV line that stays in the image history forever, or it uses shell form for CMD so the app never receives a stop signal. None of these stops the build, so you find them months later in an image scan or a production incident. A linter reads the file and points at each of them, with the line, a plain explanation and the fix.
The rules cover images and stages, apt, apk, yum, dnf, pip and npm, shell pipes, COPY and ADD, ports, healthchecks, secrets and security. Findings are errors, warnings or tips. Errors are mistakes, such as a relative WORKDIR, an unknown instruction or a port above 65535. Warnings are risks, and tips are improvements you can choose to skip, and you can hide them with a switch. Codes starting with DL follow the numbering of the well-known hadolint linter where a rule says the same thing. Codes starting with SL are this tool's own.
The rules were written for this tool from the Dockerfile reference and Docker's build best practices. The check runs in your browser and your Dockerfile, which may contain internal registry names or tokens you pasted by mistake, is not uploaded. Use it before a commit or in review. After the image builds, the next question is usually how to run it, and the docker run to compose converter turns the command into a compose file.
How to lint a Dockerfile
- Paste your Dockerfile in the box. It opens with an example full of mistakes, so you see what a report looks like.
- The findings appear as you type. The status line shows the number of errors, warnings and tips. When there are no errors or warnings, it says No errors or warnings.
- Use the Show tips switch to hide or show the lower severity tips.
- Read each row: the line, the severity, the DL or SL code, what is wrong and how to fix it. Fix from the top, since findings are listed in line order.
- When nothing is left, the result says: Nothing to report. This Dockerfile follows every rule in the linter.
- Copy the report if you want to share it in a review.
If the same project has a compose file, check it with the Docker Compose validator.
Examples
The default example
FROM ubuntu
MAINTAINER dev@example.com
ENV DB_PASSWORD=hunter2
WORKDIR app
RUN apt-get update
RUN apt-get install curl python3-pip
RUN curl -fsSL https://example.com/install.sh | sh
RUN pip install flask
ADD . /app
EXPOSE 80 70000
CMD python3 app.pyThe report has 4 errors, 10 warnings and 5 tips. Each row in the page also shows its fix:
1 warning DL3006 Image ubuntu has no tag, so it means latest.
1 info SL1005 No USER in the final stage, so the app runs as root.
1 info SL1009 The final stage has no HEALTHCHECK, so Docker cannot tell a hung app from a healthy one.
2 error DL4000 MAINTAINER is deprecated.
3 warning SL1001 ENV DB_PASSWORD holds a secret in plain text. It stays in the image history for anyone who can pull it.
4 error DL3000 WORKDIR app is a relative path. Its meaning depends on the previous WORKDIR.
5 info DL3009 The apt package lists stay in the layer after install and make the image bigger.
5 warning SL1006 apt-get update alone in its own RUN is cached by itself: a later install can use a stale index.
6 warning DL3008 apt-get install does not pin the version of: curl, python3-pip.
6 warning DL3014 apt-get install without -y waits for a confirmation that nobody can give, and the build fails.
6 info DL3015 apt-get install brings recommended packages you did not ask for.
6 info DL3059 Two RUN lines in a row create two layers.
7 warning DL4006 A pipe in RUN hides the failure of every command except the last: the build goes on after a broken download.
7 warning SL1002 A script downloaded and piped straight into a shell runs unchecked code, and a cut connection can run half of it.
8 warning DL3013 pip install does not pin the version of: flask.
8 warning DL3042 pip keeps a download cache inside the layer.
9 error DL3020 ADD for a plain file or folder does more than COPY (it fetches URLs and unpacks archives), so the result is less predictable.
10 error DL3011 Port 70000 is outside the valid range 0 to 65535.
11 warning DL3025 CMD is in shell form, so it runs under /bin/sh -c and the app does not receive stop signals.A Dockerfile with no findings
A multi-stage build for a Node app, with a pinned tag, a non-root user, a healthcheck and the JSON form of CMD:
FROM node:22-slim AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY src ./src
RUN npm run build
FROM node:22-slim
WORKDIR /app
COPY --from=build /app/dist ./dist
USER 10001
HEALTHCHECK CMD ["node","dist/health.js"]
CMD ["node","dist/main.js"]The result is No errors or warnings, with the message Nothing to report.
Mistakes that are easy to miss
FROM node:22
RUN apt-get update && apt-get install -y curl
RUN chmod 777 /tmp
COPY . .
CMD npm start
RUN foo
FRM xThis one gets 1 error, 4 warnings and 5 tips:
1 info SL1005 No USER in the final stage, so the app runs as root.
1 info SL1009 The final stage has no HEALTHCHECK, so Docker cannot tell a hung app from a healthy one.
2 warning DL3008 apt-get install does not pin the version of: curl.
2 info DL3009 The apt package lists stay in the layer after install and make the image bigger.
2 info DL3015 apt-get install brings recommended packages you did not ask for.
3 warning SL1004 chmod 777 lets any user in the container change the files.
4 warning DL3045 COPY to the relative path . with no WORKDIR set: it lands in the root folder.
4 info SL1010 COPY . copies everything in the folder, including .git, .env and local build output, unless a .dockerignore says otherwise.
5 warning DL3025 CMD is in shell form, so it runs under /bin/sh -c and the app does not receive stop signals.
7 error SL1011 FRM is not a Dockerfile instruction. Check the spelling.A file that does not start with FROM
RUN echo hi alone gives 1 error SL1000 A Dockerfile must start with FROM (only ARG may come before it). Put FROM first.
Common errors and how to fix them
Most findings come with a fix in the page. These are the ones people meet most:
- DL3006 and DL3007, image without a tag or with latest: pin a version, for example
ubuntu:24.04orpython:3.13-slim, or a digest. - DL3008, DL3013, DL3016, DL3018, unpinned packages: write
package=versionfor apt and apk,package==versionfor pip, and usenpm ciwith a lock file. - DL3009 and DL3019: end the apt
RUNwith&& rm -rf /var/lib/apt/lists/*, and useapk add --no-cache. - DL3014, apt-get install without -y: add
-y. The build has nobody to confirm. - DL3025, shell form of CMD: use the JSON form, for example
CMD ["python3", "app.py"], so the app gets stop signals. - DL3000, relative WORKDIR: use an absolute path such as
WORKDIR /app. - DL3020, ADD for plain files: use
COPY. KeepADDfor local archives you want unpacked. - DL4006, pipe in RUN: start the
RUNwithset -o pipefail &&, or setSHELL ["/bin/bash", "-o", "pipefail", "-c"]before it. - SL1001, secret in ENV or ARG: use a BuildKit secret (
RUN --mount=type=secret) or pass the value when the container runs. Generate the value with the token generator. - SL1005, no USER: add a non-root
USERnear the end of the final stage.
Frequently asked questions
How do I check a Dockerfile for mistakes?
Paste it in the box. The report lists each finding with its line, a severity, an explanation and a fix.
Is this the same as hadolint?
The DL codes match the hadolint numbering where a rule says the same thing, so you can look up a code. The rules themselves were written for this tool, and the SL codes are new. It does not run hadolint.
Should I fix every tip?
No. Tips are habits that are usually good, such as a HEALTHCHECK or a .dockerignore, and sometimes not worth it. Errors and warnings deserve a look. Use Show tips to hide the rest.
Does a clean report mean the image is secure?
No. It means the file follows these rules. It does not scan the packages in the image or the base image for vulnerabilities.