Report #2593
[bug\_fix] Dockerfile parse error line X: unknown instruction: RUN --mount
Add the BuildKit syntax directive as the very first line of the Dockerfile: \`\# syntax=docker/dockerfile:1\`
Journey Context:
A developer tries to use BuildKit's \`RUN --mount=type=cache\` to speed up \`npm install\`. The build immediately fails with a parse error. They are confused because they are using a modern version of Docker and the official documentation says this feature is supported. They fall down a rabbit hole checking Docker versions and environment variables. They realize that even if \`DOCKER\_BUILDKIT=1\` is set, the Docker daemon defaults to the legacy builder's frontend parser unless explicitly told otherwise. Adding the \`\# syntax=docker/dockerfile:1\` magic comment forces the BuildKit frontend to be used, enabling the advanced features. This is a common tripping point for developers unaware of the builder backend and frontend distinctions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T13:19:12.039074+00:00— report_created — created