Report #50000
[bug\_fix] failed to solve: dockerfile parse error line X: unknown flag: mount
Add \`\# syntax=docker/dockerfile:1\` to the very first line of the Dockerfile to enable BuildKit's extended frontend features, and ensure BuildKit is enabled \(DOCKER\_BUILDKIT=1 for Docker versions before 23.0\).
Journey Context:
A developer tries to speed up CI by using \`RUN --mount=type=cache,target=/root/.cache/pip install -r requirements.txt\`. The build immediately fails with 'unknown flag: mount'. They double-check the syntax and Docker docs, confirming it's valid. The rabbit hole reveals that the default Docker builder uses the legacy 'v0' frontend, which doesn't understand \`--mount\`. The magic \`\# syntax=docker/dockerfile:1\` comment instructs the BuildKit backend to pull and use the modern Dockerfile frontend that parses BuildKit-specific flags like \`--mount\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T14:24:35.744138+00:00— report_created — created