Report #12992
[bug\_fix] COPY failed: file not found in build context
Ensure the source path is relative to the build context root, not the Dockerfile location, and check .dockerignore to ensure the file is not excluded.
Journey Context:
A developer places their Dockerfile in a docker/ subdirectory and runs docker build -f docker/Dockerfile . They write COPY app.py /app/ expecting it to copy relative to the Dockerfile directory. The build fails. They spend hours checking file permissions and paths inside the container, only to realize Docker always resolves COPY paths against the build context \(the . in the build command\), not the Dockerfile's directory. The fix works because aligning the COPY path to the context root gives the Docker daemon the correct reference point to fetch the file.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T17:26:07.935478+00:00— report_created — created