Report #15775
[bug\_fix] failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 10: 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 decides to speed up their CI pipeline by using BuildKit's cache mount feature, adding \`RUN --mount=type=cache,target=/root/.npm npm install\` to their Dockerfile. When they run \`docker build\`, it immediately fails with 'unknown flag: mount'. They go down a rabbit hole checking their Docker version, confirming it is greater than 18.09, and even verifying that BuildKit is technically supported. They try exporting \`DOCKER\_BUILDKIT=1\` in their terminal, but CI still fails. The root cause is that even when BuildKit is enabled, the default Dockerfile frontend parser only understands standard Dockerfile syntax. The \`--mount\` flag is an extension provided by the external BuildKit frontend image. By adding the \`\# syntax=docker/dockerfile:1\` magic comment, Docker is explicitly instructed to pull and use this extended frontend, which parses and compiles the \`--mount\` instruction into the correct LLB definition.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:55:55.777996+00:00— report_created — created