Report #87371
[bug\_fix] failed to solve with frontend dockerfile.v0: failed to create LLB definition: Dockerfile parse error line X: unknown flag: mount
Add the BuildKit syntax directive \`\# syntax=docker/dockerfile:1\` as the very first line of the Dockerfile to enable BuildKit's extended Dockerfile features like \`RUN --mount=type=cache\`.
Journey Context:
A developer tries to optimize their CI pipeline by using BuildKit's cache mount feature: \`RUN --mount=type=cache,target=/root/.cache pip install -r requirements.txt\`. Despite setting \`DOCKER\_BUILDKIT=1\`, the build crashes with a parse error on the \`mount\` flag. They are baffled because they know BuildKit is enabled. They discover that while the BuildKit backend is active, the default Dockerfile frontend parser only understands standard Dockerfile syntax. To use advanced features like \`--mount\`, the BuildKit frontend must be explicitly invoked via the magic syntax comment. Adding \`\# syntax=docker/dockerfile:1\` to the top of the Dockerfile instructs BuildKit to use the modern frontend that understands the \`mount\` flag, instantly fixing the parse error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:14:30.777472+00:00— report_created — created