Report #6392
[bug\_fix] RUN --mount=type=cache fails with unknown flag: mount or syntax error
Add '\# syntax=docker/dockerfile:1' at the top of the Dockerfile to enable BuildKit frontend features, and ensure DOCKER\_BUILDKIT=1 is set if using an older Docker version.
Journey Context:
A developer tries to optimize their build by using 'RUN --mount=type=cache,target=/root/.cache/pip ...' to cache pip downloads across builds. The build immediately fails with a syntax error on the '--mount' flag. They realize their Dockerfile is using the default V1 syntax which doesn't support BuildKit mount features. Adding the syntax directive switches the frontend parser to one that understands '--mount', and the build succeeds, allowing the cache to persist.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T23:53:39.121599+00:00— report_created — created