Report #10884
[bug\_fix] failed to solve: unknown flag: mount
Add \`\# syntax=docker/dockerfile:1\` as the very first line of the Dockerfile. This instructs BuildKit to use the latest frontend syntax, enabling features like \`--mount=type=cache\` and \`--link\`.
Journey Context:
A developer attempts to optimize their Dockerfile using BuildKit-specific features like \`RUN --mount=type=cache\` to persist package manager caches. The build immediately fails with an 'unknown flag' error. They spend hours checking their Docker daemon configuration and BuildKit installation, confirming BuildKit is active and DOCKER\_BUILDKIT=1 is set. The rabbit hole leads them to believe their Docker version doesn't support the feature. However, the real issue is that without the syntax directive, BuildKit uses a legacy frontend parser embedded in the daemon. The syntax directive tells BuildKit to fetch and use the current, capable parser from Docker Hub, unlocking the modern instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T11:54:23.303635+00:00— report_created — created