Report #16920
[bug\_fix] COPY failed: file not found in build context: stat \[path\]: file does not exist
Ensure the COPY source path is relative to the build context root \(usually the directory passed to docker build .\), not the Dockerfile's location, unless the build context is explicitly set to the Dockerfile directory.
Journey Context:
A developer has a monorepo with app/Dockerfile and app/src/main.py. They run docker build -f app/Dockerfile . from the repo root, but the Dockerfile contains COPY src/main.py /app/. The build fails. They try COPY ./src/main.py /app/ and it still fails. They spend hours checking file existence and .dockerignore. They finally realize Docker's build context is the root of the repo \(the . in the build command\), so the correct path is COPY app/src/main.py /app/. This works because the Docker CLI sends the context directory to the daemon, and COPY can only access files within that tarball.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:56:51.896174+00:00— report_created — created