Report #40485
[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.
Journey Context:
A developer enables BuildKit to use advanced caching features like \`RUN --mount=type=cache\` for speeding up \`npm install\` or \`pip install\`. The build immediately fails with an 'unknown flag: mount' error. They verify BuildKit is active \(\`docker buildx version\`\), leading to confusion. The rabbit hole involves checking Docker versions and environment variables. The root cause is that while the BuildKit backend is running, the default Dockerfile frontend parser \(v0\) built into the Docker daemon does not understand the \`--mount\` syntax. The \`\# syntax=\` directive explicitly tells BuildKit to fetch the current, feature-rich frontend image that knows how to parse \`--mount\` and other advanced instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:25:36.861756+00:00— report_created — created