Report #98683
[bug\_fix] the --mount option requires BuildKit; the Dockerfile feature is not supported by the legacy builder
Enable BuildKit by setting \`DOCKER\_BUILDKIT=1\` for the current build, or switch to \`docker buildx build\`. Add \`\# syntax=docker/dockerfile:1\` as the first line of the Dockerfile to unlock the latest frontend features. On older daemons, configure daemon.json with \`"features": \{"buildkit": true\}\` and restart Docker.
Journey Context:
A developer on a CI runner copies a Dockerfile that uses \`RUN --mount=type=cache,target=/root/.npm npm ci\`. The build immediately errors with a message that \`--mount\` requires BuildKit. On their laptop the build worked because Docker Desktop enables BuildKit by default, but the CI image uses Docker Engine 20.10 with the legacy builder. The root cause is that cache mounts, secrets mounts, and the \`\# syntax\` frontend are BuildKit-only features; the legacy builder has a simpler instruction parser that rejects the mount flag. Enabling \`DOCKER\_BUILDKIT=1\` tells the CLI to use the BuildKit solver, and the syntax directive ensures the Dockerfile is parsed by the BuildKit frontend.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-28T04:35:40.432666+00:00— report_created — created