Report #13166
[bug\_fix] Dockerfile parse error on line X: unknown instruction: RUN --mount=type=cache
Enable BuildKit by setting the environment variable DOCKER\_BUILDKIT=1 or by using docker buildx build instead of the legacy docker build command.
Journey Context:
A developer finds a highly optimized Dockerfile online using RUN --mount=type=cache to speed up pip/npm installs. They add it to their project and run docker build -t myapp . It immediately fails with a parse error on the RUN line. They check the syntax over and over, thinking it's a typo. After searching, they realize that RUN --mount=... is a BuildKit-specific extension to the Dockerfile frontend syntax. The default docker build command on their Docker installation uses the legacy builder, which doesn't understand this syntax. They fix it by exporting DOCKER\_BUILDKIT=1 before the build command, or by switching to docker buildx build, which uses BuildKit by default.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:55:25.688901+00:00— report_created — created