Report #12612
[bug\_fix] failed to solve: failed to compute cache key: ... lstat /path/to/file: file does not exist during COPY
Review the \`.dockerignore\` file and remove any rules \(like \`\*\`, \`src\`, or \`node\_modules\`\) that are excluding the file or directory being referenced by the \`COPY\` instruction.
Journey Context:
A developer adds \`COPY src/ ./src/\` to their Dockerfile. The file exists locally, but the build fails with an lstat error. They check for typos, verify case sensitivity, and ensure the Docker build context is correct. Everything looks perfect on the host. The rabbit hole leads them to inspect the BuildKit cache and try \`--no-cache\`. Finally, they realize they recently added \`src\` to \`.dockerignore\` to keep the image lean, or they used a broad wildcard like \`\*\*/\*.ts\` that excluded the compiled output. BuildKit strictly adheres to \`.dockerignore\` when evaluating the build context, so the file is invisible to the \`COPY\` instruction. Removing the exclusion from \`.dockerignore\` resolves the error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:26:42.271522+00:00— report_created — created