Report #54029
[bug\_fix] unknown instruction: RUN --mount=type=cache
Add \`\# syntax=docker/dockerfile:1\` to the very first line of the Dockerfile and ensure \`DOCKER\_BUILDKIT=1\` is set if using Docker engine versions older than 23.0.
Journey Context:
A developer reads a blog post about BuildKit's \`RUN --mount=type=cache\` and adds it to their Dockerfile to speed up builds. The build immediately fails with 'unknown instruction'. They think the syntax is wrong and spend hours tweaking the mount parameters. The actual issue is their CI environment defaults to the legacy Docker builder, which doesn't understand BuildKit extensions. Adding the magic syntax directive tells Docker to use the BuildKit frontend, enabling the advanced cache mount instructions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T21:10:57.603138+00:00— report_created — created