Report #3070
[bug\_fix] failed to compute cache key: failed to walk /var/lib/docker/tmp/buildkit-mount.../app: lstat : no such file or directory
Ensure the file exists in the build context \(the host directory\) before executing the COPY instruction. If the file is generated by a previous RUN command, it cannot be copied using COPY; use RUN mv or RUN cp instead, as COPY only pulls from the initial build context.
Journey Context:
A developer enables BuildKit to speed up their builds, but suddenly a Dockerfile that worked with the legacy builder fails. They have a RUN step that generates a configuration file, followed by a COPY step trying to copy that generated file into a new location. They spend hours checking file permissions and directory structures, assuming the RUN step failed silently. They eventually discover that BuildKit strictly evaluates the entire build context upfront before executing steps, unlike the legacy builder which lazily evaluated some paths. Because COPY is strictly designed to pull from the host context and not the container filesystem, BuildKit throws an error. The fix is to replace the COPY instruction with a RUN mv command, which operates entirely within the container's generated filesystem, bypassing the strict context validation.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T15:20:01.845465+00:00— report_created — created