Dockerfile Validator
Check a Dockerfile for an uppercase instruction, a FROM line, and a small set of argument shapes.
🔒 Processed entirely in your browser — nothing you enter here is ever uploaded.
The result appears on this page after you run the tool. Nothing you enter is uploaded.
Result
About this tool
Paste the file and run the check. Blank lines and lines whose trimmed text starts with # are ignored. A trailing backslash joins the next line with a space before the instruction is read, so a continued RUN is one instruction. The first word must be one of FROM, RUN, CMD, LABEL, MAINTAINER, EXPOSE, ENV, ADD, COPY, ENTRYPOINT, VOLUME, USER, WORKDIR, ARG, ONBUILD, STOPSIGNAL, HEALTHCHECK, or SHELL. The word must already be uppercase. from fails even though FROM is known, with a message that asks for the uppercase form. An unknown word fails as an unknown instruction. The arguments after the word cannot be empty.
FROM is special. The file must contain at least one FROM, or the final message says so. Until a FROM has been seen, the only instruction allowed is ARG. A RUN before any FROM fails with the message that the file must start with FROM and that only comments or ARG may precede it. The FROM arguments themselves must match one of two patterns: an image name with an optional :tag and an optional as name, or an image@digest with an optional as name. The name character set is letters, digits, underscore, hyphen, dot, and slash. FROM ubuntu:22.04 passes that pattern. FROM ubuntu:22.04 AS app passes. FROM --platform=linux/amd64 ubuntu:22.04 does not, because the flag is not in the pattern. A variable such as FROM ${IMAGE} does not match either.
EXPOSE is the other instruction with its own argument check. Each whitespace-separated token must be digits, or digits plus /tcp or /udp. EXPOSE 80 and EXPOSE 443/tcp pass. EXPOSE 80/http fails. Every other known instruction only checks that some argument text exists. The checker does not parse shell quoting inside RUN, does not resolve COPY paths, and does not know that a HEALTHCHECK has a required CMD of its own. MAINTAINER is still in the allowed set even though Docker deprecated it. A file of only comments fails because no FROM was seen. Success says Dockerfile syntax is valid! That means this instruction list and the two special argument checks passed. It does not mean docker build would succeed. The page never contacts a registry and never executes RUN. A failure names the line where the instruction started, and the page reprints the surrounding lines. The text stays in the browser. If you rely on BuildKit platform flags or ARG values inside FROM, this page will reject files that Docker itself accepts. That strict FROM pattern is the limit to plan around.
Example. FROM ubuntu:22.04 followed by RUN echo hi passes. The lowercase word from fails. FROM --platform=linux/amd64 ubuntu:22.04 fails the image pattern. EXPOSE 80/http fails. EXPOSE 443/tcp passes.
Limit. Only the listed uppercase instructions are known. FROM arguments must match image:tag or image@digest, with an optional AS name. Platform flags and ${IMAGE} are rejected. No image is built.
Why is a lowercase from rejected?
The first word has to be uppercase even when the uppercase form is in the allowed set. from produces the message that asks for FROM. The allowed names are the classic Dockerfile instructions from FROM through SHELL, including the deprecated MAINTAINER.
Can I put a platform flag on FROM?
Not here. FROM ubuntu:22.04 and FROM ubuntu:22.04 AS app match the pattern. FROM --platform=linux/amd64 ubuntu:22.04 does not, and neither does FROM ${IMAGE}. Docker BuildKit accepts flags this page rejects. The page does not pull the image or run a build.
What may appear before FROM?
Comments, blank lines, and ARG. Any other instruction before the first FROM fails. A file with no FROM at all fails even if every other line was a comment. A backslash at the end of a line joins the next line before these rules run.
How are EXPOSE ports checked?
Each token must be a number or a number plus /tcp or /udp. 80 and 443/tcp pass. 80/http fails. RUN, COPY, ENV, and the other instructions are not parsed beyond requiring some argument text.