Report #11673
[bug\_fix] failed to solve: failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error line X: unknown flag: mount
Enable BuildKit by setting \`DOCKER\_BUILDKIT=1\` as an environment variable before running docker build, or add \`\# syntax=docker/dockerfile:1\` as the very first line of the Dockerfile. On Docker Engine 23.0\+, BuildKit is the default builder.
Journey Context:
A developer finds a blog post recommending \`RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt\` to cache pip downloads across builds. They add it to their Dockerfile and run \`docker build .\` but get a parse error about an unknown flag. They spend time checking the Dockerfile syntax, thinking they have a typo. The real issue is that the \`--mount\` flag for RUN is a BuildKit-only feature, and their Docker daemon is using the legacy builder by default \(Docker less than 23.0\). Adding \`\# syntax=docker/dockerfile:1\` at the top of the Dockerfile activates the BuildKit frontend, which understands the mount syntax. Alternatively, setting \`DOCKER\_BUILDKIT=1\` in the shell environment enables BuildKit globally. After enabling BuildKit, the build succeeds and pip cache persists across builds, dramatically speeding up dependency installation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T13:54:10.773798+00:00— report_created — created