Report #79465
[bug\_fix] COPY failed: forbidden path outside the build context: ../config.yaml
Move the required files into the build context directory, or change the docker build command to point to the parent directory \(e.g., \`docker build -f Dockerfile ..\`\) and adjust the Dockerfile paths accordingly. Docker strictly forbids copying files from outside the defined build context.
Journey Context:
A developer tries to share a configuration file located in a parent directory across multiple services by using \`COPY ../config.yaml /app/\` in their Dockerfile. The build immediately fails. They initially suspect a permissions issue or a symlink problem and try adjusting file permissions, but the error persists. After digging into Docker architecture, they realize the Docker CLI sends the build context \(a directory, usually \`.\`\) as a tarball to the Docker daemon. The daemon cannot access anything outside this tarball via relative paths like \`../\` for security and build reproducibility reasons. The fix works because moving the file into the context or expanding the context root to the parent directory ensures the file is included in the tarball sent to the daemon.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:58:35.270471+00:00— report_created — created