Report #15208
[bug\_fix] COPY failed: forbidden path outside the build context
Move the required files into the build context directory and adjust the Dockerfile COPY paths, or change the docker build context root. Docker strictly forbids copying files from outside the defined build context because the client only sends that context to the daemon.
Journey Context:
A developer tries to share a common configuration file across multiple services located in sibling directories. They write COPY ../../common/config.yml /app/ in their Dockerfile. The build immediately fails with a 'forbidden path' error. They try using symlinks, but Docker resolves them within the context and they still fail. After digging into Docker architecture, they realize that 'docker build .' sends the current directory \(the context\) as a tarball to the Docker daemon. The daemon is isolated and cannot access the host's filesystem outside that tarball. The realization hits that the build context must be expanded to the repository root \(e.g., docker build -f service/Dockerfile .\), and the COPY instruction adjusted to the new root context.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:25:27.694766+00:00— report_created — created