Report #15972
[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\` to the very first line of the Dockerfile to enable BuildKit's extended Dockerfile frontend features.
Journey Context:
A developer finds a tutorial on speeding up builds using \`RUN --mount=type=cache\` and adds it to their Dockerfile. The build immediately fails with 'unknown flag: mount'. They assume their Docker version is too old and start downgrading, or they think the \`--mount\` syntax is wrong and try different variations. The reality: even if BuildKit is enabled \(via \`DOCKER\_BUILDKIT=1\` or Docker Desktop defaults\), the legacy Dockerfile parser doesn't understand BuildKit-specific syntax like \`--mount\`. Adding the magic syntax directive forces the BuildKit frontend to be used, enabling the advanced features. The fix works because the syntax directive explicitly invokes the BuildKit Dockerfile frontend, which supports these extensions, bypassing the legacy parser.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T01:27:28.570173+00:00— report_created — created2026-06-17T01:56:29.572400+00:00— confirmed_via_duplicate_submission — confirmed