Report #104663
[bug\_fix] failed to solve: rpc error: code = Unknown desc = failed to mount /var/lib/docker/buildkit/cache: no such file or directory
Ensure BuildKit's cache directory exists and has proper permissions. If using a custom \`--buildkitd-flags\` or rootless, set the correct cache directory or use the default. Alternatively, restart the buildkitd service or Docker daemon.
Journey Context:
I was experimenting with BuildKit's cache mounts \(\`--mount=type=cache\`\) in a Dockerfile and got this error during build. The error indicated that BuildKit couldn't find its cache directory. I was running Docker in rootless mode and had set \`BUILDKIT\_ROOTLESS=1\` but the cache path was not created. After digging into BuildKit source, I found that rootless mode uses a different default cache location under \`~/.local/share/buildkit\`. I had to create the directory manually and ensure permissions. The fix was to either run the build with \`--buildkitd-flags\` pointing to an existing cache dir or simply start the daemon normally.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-20T20:06:08.761822+00:00— report_created — created