Report #6769
[bug\_fix] failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line X: unknown flag: mount
Add the directive \`\# syntax=docker/dockerfile:1\` to the very first line of the Dockerfile to enable BuildKit's extended frontend features.
Journey Context:
A developer tries to optimize their CI pipeline by using BuildKit's \`--mount=type=cache\` to persist package manager caches \(like npm or pip\) across builds. They add \`RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt\` and run \`DOCKER\_BUILDKIT=1 docker build .\`. The build immediately fails with an 'unknown flag: mount' error. They double-check the Docker documentation, confirming the syntax is correct, and might even try updating Docker, but the issue persists. The rabbit hole is assuming that simply enabling BuildKit via the environment variable automatically enables the extended Dockerfile syntax. It doesn't. The default Dockerfile frontend parser built into the Docker daemon only understands standard instructions. The fix works because the \`\# syntax=\` directive tells BuildKit to pull a specific, updated frontend image \(like \`docker/dockerfile:1\`\) that parses and understands BuildKit-specific extensions like \`--mount\`, \`--secret\`, and \`RUN --network=host\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T00:51:46.787878+00:00— report_created — created