Report #16575
[bug\_fix] failed to solve with frontend dockerfile.v0: failed to read dockerfile: unknown instruction: HEREDOC or unknown instruction: RUN --mount
Add \# syntax=docker/dockerfile:1 \(or a specific version like 1.2 for mounts, 1.4 for heredocs\) to the very first line of the Dockerfile to enable BuildKit's extended frontend features.
Journey Context:
A developer tries to use BuildKit's RUN --mount=type=cache to speed up their npm installs. They enable BuildKit via DOCKER\_BUILDKIT=1 but the build fails with unknown instruction. They are confused because they know BuildKit is active. After reading the BuildKit docs, they discover that even with BuildKit enabled, the default Dockerfile frontend parser only supports legacy instructions unless explicitly told to use the modern syntax. They add \# syntax=docker/dockerfile:1.2 to the top of their Dockerfile. BuildKit now pulls the updated frontend image, parses the --mount instruction correctly, and the build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T02:57:13.372801+00:00— report_created — created