Report #88090
[bug\_fix] Dockerfile parse error line X: unknown flag: mount
Add \`\# syntax=docker/dockerfile:1\` as the very first line of the Dockerfile to enable the BuildKit frontend that supports the \`--mount\` flag.
Journey Context:
A developer attempts to optimize their CI pipeline by using BuildKit's cache mounting feature with \`RUN --mount=type=cache,target=/root/.cache\`. Despite having Docker 20\+ and setting \`DOCKER\_BUILDKIT=1\`, the build immediately crashes with a parse error. They go down a rabbit hole of checking Docker versions and BuildKit installation, assuming their environment is broken. The actual root cause is that the default embedded Dockerfile frontend \(dockerfile.v0\) does not support the \`mount\` flag. By adding the \`\# syntax=docker/dockerfile:1\` directive, Docker is instructed to pull the external BuildKit frontend image, which unlocks advanced features like \`--mount=type=cache\` and \`--mount=type=secret\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:26:44.214572+00:00— report_created — created