Dockerfile linter
Check a Dockerfile for untagged images, secrets in ENV, apt-get mistakes, curl-pipe-sh and running as root. The rules run in your browser.
Everything here runs in your browser. Nothing you type is sent to D's Labs or anyone else.
line 1 warning — Pin a tag for python (for example python:<version>); an untagged image means :latest and changes under you. DL-tag
line 1 info — The final stage never sets USER, so the container runs as root. Add a non-root USER if the app does not need root. DL-root
line 2 error — ENV looks like a secret. It is stored in the image history for anyone with the image; pass it at run time or use a build secret. DL-secret
line 3 warning — apt-get update in its own RUN is cached separately, so a later install can use a stale package list. Combine them: apt-get update && apt-get install -y … DL-apt-update
line 4 error — apt-get install needs -y, or the build stops at the prompt. DL-apt-y
line 4 info — Add --no-install-recommends to keep the image small. DL-apt-recommends
line 4 info — Remove /var/lib/apt/lists/* in the same RUN to keep the package index out of the layer. DL-apt-lists
line 5 warning — Use COPY for local files; ADD also unpacks archives and fetches URLs, which surprises readers. DL-add
line 6 info — pip install --no-cache-dir keeps the download cache out of the image. DL-pip-cache
line 6 info — Use WORKDIR instead of cd; cd lasts only for this RUN. DL-cd
line 7 info — Shell-form CMD runs under /bin/sh -c, so the process does not get signals; prefer CMD ["prog", "arg"]. DL-cmd-shell
Why these rules
Every instruction becomes a layer that anyone with the image can read, so a secret in ENV or ARG is published with it. An untagged base image changes under you on the next build. apt-get update in its own layer gets cached and goes stale. And a container that never sets USER runs as root. These are the mistakes that turn up most in real Dockerfiles; this checker is a starting point, not a full audit.