Report #38760
[bug\_fix] failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line X: unknown flag: mount
Add the syntax directive \# syntax=docker/dockerfile:1 to the very first line of the Dockerfile to enable BuildKit's extended Dockerfile frontend features.
Journey Context:
A developer decides to optimize their CI pipeline by using BuildKit's cache mounting feature \(RUN --mount=type=cache...\) to persist package manager caches between builds. Despite having DOCKER\_BUILDKIT=1 set, the build immediately fails with a parse error on the mount flag. They check Docker documentation, verify their Docker Engine version, and try escaping the command, assuming it's a shell parsing issue. The root cause is that while the BuildKit backend is active, the default Dockerfile parser \(frontend\) only understands legacy Dockerfile syntax. The magic comment explicitly tells BuildKit to use the modern external frontend image that understands advanced instructions like --mount, --secret, and --link.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T19:32:11.912578+00:00— report_created — created