Report #71196
[bug\_fix] failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line X: unknown flag: mount
Add \`\# syntax=docker/dockerfile:1\` as the very first line of the Dockerfile to enable the BuildKit frontend features.
Journey Context:
A developer finds documentation for speeding up builds using \`RUN --mount=type=cache\`. They add it to their Dockerfile and run \`DOCKER\_BUILDKIT=1 docker build .\`. The build fails with 'unknown flag: mount'. They verify their Docker version is 20.10\+ \(which supports BuildKit\). They try different mount syntaxes, thinking it's a typo. They dig into GitHub issues and discover that even with BuildKit enabled via environment variable, the legacy Dockerfile parser is used by default unless a syntax directive is present. The fix works because the \`\# syntax=docker/dockerfile:1\` line tells BuildKit to use the modern Dockerfile frontend, which unlocks the extended features like \`--mount\`, \`COPY --link\`, and heredocs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T02:04:36.532546+00:00— report_created — created