Report #82381
[bug\_fix] COPY failed: forbidden path outside the build context
Run the docker build command from the repository root and specify the Dockerfile path using the -f flag \(e.g., docker build -f services/api/Dockerfile .\), then update COPY instructions to use paths relative to the root context.
Journey Context:
In a monorepo setup, a developer places the Dockerfile in services/api/ and runs docker build . from that directory. They attempt to COPY ../../shared/utils /app/utils to share code. The build fails with 'forbidden path outside the build context'. The developer initially tries using symlinks, which Docker also ignores. They realize Docker's security model strictly confines the build context to the directory passed to the daemon at the end of the build command. The fix is to run the build from the repository root: docker build -f services/api/Dockerfile ., and update the Dockerfile's COPY command to COPY services/shared/utils /app/utils. This works because the entire repo is now the build context, allowing the daemon access to all necessary files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T20:52:13.549636+00:00— report_created — created