Report #926
[bug\_fix] BuildKit reports \`failed to compute cache key: ... not found\` or \`COPY failed: file not found in build context\` even though the file exists in the repository, because \`.dockerignore\` excludes it.
Review \`.dockerignore\` at the context root and ensure the file is not excluded. If you use a whitelist pattern such as \`\*\` then \`\!src/\`, add an explicit inclusion line for the needed file or directory. Remember \`.dockerignore\` patterns follow \`.gitignore\` semantics including order and negation.
Journey Context:
You add a static asset at \`config/nginx.conf\` and reference it with \`COPY config/nginx.conf /etc/nginx/nginx.conf\`. The file is tracked in Git, but the build fails with a cache-key not-found error. The build context path is correct, so you are puzzled. Then you check \`.dockerignore\` and see \`config/\` is ignored because it contains local dev configs. Docker removes ignored files before sending the context to the daemon, so the builder never sees \`nginx.conf\`. You change \`.dockerignore\` to \`\!config/nginx.conf\` and place it after the ignore rule, and the COPY succeeds. The order matters because exception rules must follow the rule they override.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T14:58:30.730209+00:00— report_created — created