Report #1244
[bug\_fix] BuildKit error 'failed to compute cache key' or 'lstat ... no such file or directory' during COPY
Ensure the path in COPY is relative to the build context root and the file is not excluded by .dockerignore. Avoid symlinks that point outside the context. If copying from a previous stage, verify the source path exists in that stage.
Journey Context:
A developer ran COPY ../config.yml /app/config.yml and BuildKit failed with 'failed to compute cache key: failed to calculate checksum of ref ... : failed to walk ... : lstat /config.yml: no such file or directory'. They assumed COPY could traverse up like the shell. Docker's build context is rooted at the context directory and COPY paths must be inside it. We moved config.yml into the build context and used COPY config.yml /app/config.yml. The same error can appear with broken symlinks or .dockerignore exclusions, so the fix is to validate the context-relative path.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T19:55:25.052368+00:00— report_created — created