Dockerfile Linter

Check a Dockerfile against best practices before it ships. Paste it, or drop several Dockerfiles at once, and get every problem by line — unpinned base images, layers that bust the cache, packages left behind by apt, secrets baked in with ENV, containers running as root, CMD in a form that ignores shutdown signals — each with a suggested fix. Multi-stage builds and line continuations are understood. It's free, runs in your browser, and nothing is uploaded.

Most common findings

ProblemFix
FROM image:latestPin a version or digest
COPY . . before npm ciCopy manifests, install, then copy source
apt-get install without cleanup&& rm -rf /var/lib/apt/lists/*
No USER in final stageCreate a user; USER app before CMD
CMD npm startCMD ["npm", "start"]
ENV API_KEY=…RUN --mount=type=secret or runtime env

When to use it

  1. Review a Dockerfile in a pull request.
  2. Find out why an image is so large or slow to build.
  3. Catch a secret accidentally put in ENV before pushing an image.
  4. Audit every Dockerfile in a repository at once.

How to Use

  1. Paste a Dockerfile, or drop several files or a repo folder.
  2. Read the findings by line and severity.
  3. Apply the suggested fixes.

Features

  1. 28 best-practice rules
  2. Line numbers, severity and fixes
  3. Multi-stage and continuation aware
  4. Secret detection
  5. Several Dockerfiles at once
  6. 100% client-side

FAQs

Why is FROM node:latest a problem?

latest changes whenever a new version is released, so the same Dockerfile can build a different image tomorrow. Pin a version.

Why does layer order matter?

Docker reuses a cached layer only if nothing before it changed. Copying all your code before installing dependencies means every code change reinstalls them.

Why is ENV PASSWORD=… dangerous?

ENV and ARG values are stored in the image and visible to anyone who pulls it. Use build secrets or runtime environment variables.

What's wrong with CMD npm start?

In shell form the command runs under /bin/sh, which doesn't forward SIGTERM, so the container is killed instead of shutting down cleanly.

Is this the same as hadolint?

It covers the most common rules in the browser. For CI, hadolint adds ShellCheck analysis of RUN commands.

Is my Dockerfile uploaded?

No. It's linted in your browser.

Technical Details

The linter first parses the Dockerfile the way Docker does: backslash continuations are joined into one instruction, comment lines inside a continuation are dropped, and each instruction is tagged with the build stage it belongs to, so a later FROM build that names an earlier stage isn't mistaken for an unpinned image. Rules then run per instruction and per stage. They catch base images on :latest or with no tag; ADD used for local files; apt-get install without -y, without --no-install-recommends, without update in the same RUN or without removing /var/lib/apt/lists; apk without --no-cache; npm install instead of npm ci; pip without --no-cache-dir; curl piped into a shell; cd instead of WORKDIR; sudo; secrets assigned in ENV or ARG, which are baked into the image history; shell-form CMD and ENTRYPOINT, which stop signals reaching the process; invalid EXPOSE ports; relative WORKDIR; duplicate CMD or ENTRYPOINT; and COPY . . before the dependency install, which defeats layer caching. The final stage is checked for a non-root USER and a HEALTHCHECK. Each finding has a line number, a severity and a concrete fix.

Developer Tools

Developer Tools

  • SSH Config Generator
  • .dockerignore Generator
  • README Badge Generator
  • JSON to Zod
  • HTML Table Generator
  • Regex Cheatsheet
  • JSON to GraphQL
  • Regex Escape & Extract