Report #92257
[bug\_fix] COPY failed: forbidden path outside the build context
Move the required files into the build context directory, or change the Docker build context root. You cannot use relative paths like ../ to step outside the directory passed to the Docker daemon.
Journey Context:
A developer working in a monorepo attempts to use COPY ../shared-library ./ in their Dockerfile to share code between microservices. The build immediately fails. They try using symlinks, but Docker resolves them outside the context, failing again. The rabbit hole leads to realizing that the Docker CLI zips up the build context directory and sends it to the daemon; the daemon has no access to the parent directory for security and sandboxing reasons. The fix is to run the build from the monorepo root \(docker build -f services/service-a/Dockerfile .\) and adjust the COPY paths accordingly, or copy the shared code into the service directory prior to building.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:26:45.634611+00:00— report_created — created