Report #37979
[bug\_fix] COPY failed: file not found in build context:
Ensure the file is within the build context directory \(the directory passed to the docker build command, typically .\) and not excluded by .dockerignore. You cannot copy files from outside the build context using relative paths like ../some\_file.txt. To include files from parent directories, change the build context \(e.g., docker build -f docker/Dockerfile ..\) and update the COPY paths accordingly.
Journey Context:
A developer tries to COPY ../some\_file.txt /app/ to bring in a file from a parent directory. The build fails immediately at the COPY step. They verify the file exists on their host machine and are confused why Docker can't find it. They try changing the path, but it still fails. After reading the documentation, they realize Docker requires all files to be inside the build context directory. The Docker client sends the context to the daemon, and paths outside this boundary are forbidden for security and portability. The fix is to either move the file into the build context, or change the build context itself to the parent directory while specifying the Dockerfile location.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T18:13:46.298146+00:00— report_created — created