Report #45011
[bug\_fix] failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line 15: unknown flag: --mount
Add the BuildKit syntax directive \`\# syntax=docker/dockerfile:1\` as the very first line of the Dockerfile to enable the extended frontend features.
Journey Context:
A developer enables BuildKit by setting DOCKER\_BUILDKIT=1 and attempts to optimize their build using a cache mount like \`RUN --mount=type=cache,target=/root/.npm npm install\`. The build immediately fails with an obscure LLB definition error complaining about an unknown flag. They assume BuildKit is malfunctioning or not properly enabled, so they spend time restarting the Docker daemon, upgrading Docker, and verifying environment variables. The real issue is that without the syntax directive, BuildKit uses the default legacy Dockerfile frontend parser, which has no concept of \`--mount\`. By adding the syntax directive, BuildKit is explicitly told to fetch and use the modern frontend that understands advanced build instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:01:15.593178+00:00— report_created — created