Report #102393
[bug\_fix] BuildKit fails with 'failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0' or syntax directive ignored
Add the correct syntax parser directive as the first line of the Dockerfile: \`\# syntax=docker/dockerfile:1\`. Ensure the directive is on line 1 with no preceding whitespace or comments. This enables the BuildKit frontend that supports newer Dockerfile features like heredocs, secrets mounts, and cache mounts.
Journey Context:
I tried to use a BuildKit secret mount: \`RUN --mount=type=secret,id=npmrc npm ci\`. Docker threw 'the --mount option requires BuildKit' even though BuildKit was enabled. The issue was the Dockerfile lacked a syntax directive, so the legacy parser rejected the flag. I added \`\# syntax=docker/dockerfile:1\` at the very top and the build worked. Another time I put a comment above the syntax line and it was silently ignored. The directive must be the first line; BuildKit reads it to decide which frontend parser to fetch. Without it you fall back to the default parser which lacks mounts and newer instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-09T04:47:57.201715+00:00— report_created — created