Report #15408
[bug\_fix] Dockerfile parse error line X: unknown instruction: RUN --mount=type=cache
Add the BuildKit syntax directive '\# syntax=docker/dockerfile:1' as the very first line of the Dockerfile.
Journey Context:
A developer hears about BuildKit's cache mount feature to speed up package installations without bloating the image. They add 'RUN --mount=type=cache,target=/root/.cache pip install -r requirements.txt' to their Dockerfile and run 'DOCKER\_BUILDKIT=1 docker build .'. The build immediately fails with a parse error. They are confused because they know BuildKit is enabled. After searching, they discover that while the BuildKit backend is active, the default Dockerfile frontend parser only supports the standard instructions. To use experimental extensions like --mount, the Dockerfile must explicitly invoke the extended frontend by specifying the syntax directive at the top.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:56:01.382857+00:00— report_created — created