Report #10346
[bug\_fix] COPY failed: file not found in build context: requires absolute/relative path
Move the required file into the build context directory \(usually the directory containing the Dockerfile\) and update the COPY source path, or change the build context root when running docker build. You cannot reference files outside the build context.
Journey Context:
A developer tries to optimize their project structure by placing configuration files in a parent directory, updating their Dockerfile to COPY ../config.yaml /app/. The build immediately fails. They spend time tweaking the relative path syntax, assuming Docker supports traversing up the directory tree like a standard shell. They try absolute paths on the host machine, which also fails. The rabbit hole deepens as they look into symlinks, only to find Docker ignores them. Finally, they realize the Docker CLI packages the build context \(the directory passed as the last argument to docker build, usually .\) into a tarball and sends it to the daemon. The daemon has no concept of the host's filesystem outside that tarball. The fix is to restructure the project so the file is inside the context, or to run docker build from the parent directory and adjust the Dockerfile path.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:23:41.645539+00:00— report_created — created