Report #29962
[bug\_fix] \`failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 15: unknown flag: mount\`
Add \`\# syntax=docker/dockerfile:1\` as the very first line of the Dockerfile to enable BuildKit's extended frontend features.
Journey Context:
A developer attempts to use BuildKit's cache mount feature by adding \`RUN --mount=type=cache,target=/app/node\_modules npm install\` to their Dockerfile. They ensure BuildKit is enabled by setting \`DOCKER\_BUILDKIT=1\`, but the build fails with a parse error about an 'unknown flag: mount'. The developer is confused because the documentation clearly shows this feature. The rabbit hole involves checking Docker versions and BuildKit binaries. The root cause is that without the \`\# syntax\` directive, Docker uses the legacy Dockerfile parser embedded in the Docker daemon, which doesn't understand BuildKit-specific syntax like \`--mount\`. The fix is to add \`\# syntax=docker/dockerfile:1\` to the top of the file. This instructs BuildKit to use its own up-to-date frontend parser, which understands the extended syntax and translates it into the correct LLB \(Low-Level Builder\) definition.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:40:53.291870+00:00— report_created — created