Dockerfile Linter

Lint a Dockerfile for best-practice violations and security issues

Ad placeholder (leaderboard)

The Dockerfile Linter checks a pasted Dockerfile against widely-used best-practice and security rules — the same kinds of issues hadolint flags — and explains each finding so you can fix it. Everything runs in your browser.

How it works

The linter first tokenises the Dockerfile into instructions, joining lines that end with a backslash continuation and skipping comment lines. It then applies a rule set to each instruction and to the file as a whole:

  • Base image pinning — warns on untagged images and on the latest tag, which is not reproducible.
  • Package manager hygiene — flags apt-get install without --no-install-recommends, apt-get update in its own layer, missing apt list cleanup, and apk add without --no-cache.
  • Layer and path correctnesscd inside RUN (use WORKDIR), relative WORKDIR paths, and ADD where COPY is the safer choice.
  • Security — running as root at the final stage, use of sudo, and piping a curl/wget download straight into a shell without pipefail.
  • Runtime correctness — shell-form CMD/ENTRYPOINT (use the JSON exec form so signals are forwarded) and a missing HEALTHCHECK.

Example

A line like the following:

RUN apt-get update && apt-get install curl

triggers a warning to combine update and install in one layer and to add --no-install-recommends, plus a note to clean /var/lib/apt/lists in the same RUN so the image stays small.

Notes

Severities are advisory: error marks things that are almost always wrong, warning marks strong best practices, and info marks size or hardening optimisations. This linter is a quick preview — keep hadolint in CI for full rule coverage and shellcheck integration.

Ad placeholder (rectangle)