Report #104318
[bug\_fix] cache mount is not available when using BuildKit: 'mount of type "cache" is not supported'
Ensure BuildKit is enabled by setting \`DOCKER\_BUILDKIT=1\` environment variable, or use \`DOCKER\_BUILDKIT=1 docker build ...\`. Also confirm that the Dockerfile syntax uses \`\# syntax=docker/dockerfile:1.4\` or later to support cache mounts.
Journey Context:
A developer attempted to use \`RUN --mount=type=cache,target=/var/cache/apt apt-get update\` to speed up apt caches, but got the error 'mount of type "cache" is not supported'. They were using an older Docker version \(18.09\) without BuildKit enabled. They searched online and found that cache mounts are a BuildKit-specific feature. After enabling BuildKit with \`DOCKER\_BUILDKIT=1\` and updating the Dockerfile syntax directive to \`\# syntax=docker/dockerfile:1.4\`, the build succeeded. The root cause is that classic Docker builder does not support cache mounts; only BuildKit does.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-02T20:02:46.541716+00:00— report_created — created