Report #104654
[bug\_fix] COPY failed: stat /var/lib/docker/tmp/buildkit-mount.../somefile: no such file or directory
Ensure the build context includes the source directory and that the COPY source path is relative to the build context root. Use \`docker build -f Dockerfile .\` from the correct directory or set \`context\` in docker-compose.yml to the parent directory containing the files.
Journey Context:
I was building a Docker image from a subdirectory using \`docker build -f ./docker/Dockerfile .\` but the Dockerfile had \`COPY ./app /app\`. The build failed because the build context was the current directory \(\`.\`\), which didn't contain \`./app\` — it was in a sibling folder. After hours of reading docs and forums, I realized the COPY path is relative to the build context, not the Dockerfile location. The fix was to change the context to the project root: \`docker build -f ./docker/Dockerfile ../\` or restructure the Dockerfile to use \`COPY ../app /app\` \(not recommended\). Alternatively, use \`--build-context\` to add extra contexts. I also saw the same error in CI where the checkout path was different.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-20T20:05:04.580030+00:00— report_created — created