Dockerfile parse error line 3: unknown instruction FRO
Fixes 'Dockerfile parse error: unknown instruction' when the Dockerfile has a typo or unsupported instruction. Use when the build fails at parse time naming a line and instruction. Not for 'failed to read dockerfile' (file missing) or RUN failures.
TL;DR: Fix the typo on the reported line. FRO becomes FROM, and check for stray characters or wrong case on instruction keywords. Instructions must be uppercase at the start of a line; the parser tells you the exact line number, so go look at it.
The error
Dockerfile parse error line 3: unknown instruction: FROFix it
- Open the Dockerfile at the reported line:
sed -n '1,10p' Dockerfile Expected: you see the typo on line 3.
- Fix it (
FROtoFROM, or whatever the instruction should be). - Rebuild.
When this applies
- Typos in instruction keywords (FRO, RNU, COPPY)
- Lowercase instructions in strict parsers or stray invisible characters
When this does NOT apply
- "failed to read dockerfile" (the file was never found)
- Errors inside RUN shell commands (those parse fine; the shell fails later)
Versions
All Docker versions; BuildKit reports Dockerfile parse error line N.
Why it happens
The Dockerfile frontend parses instructions before executing anything. An unrecognized keyword aborts the parse immediately, which is why the failure is instant and names a line number.
Edge cases
- A
# syntax=directive pinning an old frontend can reject newer instructions (e.g.COPY --link); either update the syntax line or avoid the new flag. - Missing line continuations (
\at end of line) merge two lines into one and the parser blames the wrong instruction; check the lines above the reported one. - BOM or CRLF line endings from Windows editors can confuse older parsers; save as UTF-8 LF.
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.