Report #2057
[bug\_fix] ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref : "/main.c": not found
Ensure the file exists inside the build context root that you pass to docker build. If your Dockerfile is in a subdirectory, run from the project root and use -f, e.g. \`docker build -f docker/Dockerfile .\`. When building from stdin \(\`docker build - < Dockerfile\`\) there is no filesystem context, so COPY cannot access local files. Also check .dockerignore. The error means BuildKit could not compute a cache checksum because the referenced path is absent from the context it received.
Journey Context:
I was building from inside the docker/ directory with \`docker build .\` and my Dockerfile had \`COPY main.c .\`. The file sat at the repo root. BuildKit errored with 'failed to compute cache key ... /main.c not found'. I confirmed \`ls ../main.c\` worked, so the file existed on disk but not in the context. I learned that COPY source paths are relative to the build context directory, not the Dockerfile directory. Moving the context argument to the repo root \(\`docker build -f docker/Dockerfile ..\` or running from root\) sent the file to BuildKit and the checksum computed successfully.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T09:52:30.791753+00:00— report_created — created