Report #17838
[bug\_fix] failed to compute cache key: failed to walk /var/lib/docker/tmp/buildkit-mount...: failed to follow symlink: permission denied or not found during a COPY instruction.
Remove symlinks in the build context that point outside the context directory, or restructure the project so the Dockerfile has access to the linked files within the context.
Journey Context:
A developer has a project with a shared library linked via a symlink \(e.g., \`app/shared -> ../../shared\_lib\`\). They run \`docker build .\` and it fails with a cryptic BuildKit error about failing to follow a symlink or compute a cache key. They verify the symlink works perfectly on their host machine. They try changing file permissions, running Docker as root, and disabling BuildKit \(which sometimes silently ignores or copies empty directories instead\). The root cause is a security feature in BuildKit: it strictly forbids symlinks from escaping the build context directory. If a symlink resolves to a file outside the directory passed to \`docker build\`, BuildKit will refuse to follow it to prevent arbitrary host file access. The fix requires either moving the shared library into the build context or using a \`.dockerignore\` to exclude the symlink and copying the files in via a different mechanism \(like git submodules or a build script that copies the files before \`docker build\`\).
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T06:28:20.856635+00:00— report_created — created