Report #72317
[bug\_fix] COPY failed: forbidden path outside the build context: ...
Move the required files into the build context directory \(usually the directory containing the Dockerfile\) and use relative paths in the COPY instruction, or copy files between multi-stage builds using COPY --from=.
Journey Context:
A developer attempts to optimize their CI pipeline by copying a configuration file from a sibling directory using COPY ../../configs/app.yaml /app/. The build immediately fails with a 'forbidden path' error. They try using an absolute path, which also fails. After going down a rabbit hole of file permission checks and Docker daemon restarts, they realize the Docker client sends the entire build context \(the directory specified at the end of the docker build command, typically .\) as a tarball to the daemon. The daemon cannot access anything outside this tarball for security reasons. They restructure the repository to include the config files within the build context or move the Dockerfile to the repository root, adjusting the COPY path to a relative path inside the context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T03:58:02.782835+00:00— report_created — created