Report #86910
[bug\_fix] Dockerfile parse error line X: unknown flag: --mount
Enable BuildKit by setting the environment variable DOCKER\_BUILDKIT=1 before running docker build, or use the docker buildx build command instead of docker build.
Journey Context:
A developer tries to speed up their CI pipeline by using BuildKit's cache mount syntax: RUN --mount=type=cache,target=/root/.cache. The build immediately fails with a parse error. They spend time double-checking the syntax, adding quotes, and trying different mount types, assuming they made a typo. Eventually, they realize that the default docker build command on their CI runner uses the legacy Docker builder, which does not understand the --mount flag. By exporting DOCKER\_BUILDKIT=1 or switching to docker buildx build, the Docker daemon routes the build through BuildKit, which natively parses and executes the advanced syntax.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:27:49.390595+00:00— report_created — created