Report #86912
[bug\_fix] COPY failed: forbidden path outside the build context
Restructure the build command to use the repository root as the Docker build context \(e.g., docker build -f services/api/Dockerfile .\) and update the COPY paths in the Dockerfile to be relative to that root.
Journey Context:
In a monorepo, a developer runs docker build from the services/api/ directory. The Dockerfile attempts to copy shared libraries using COPY ../../libs/shared /app/shared. The build fails because the Docker daemon only receives the current directory as the build context and cannot access parent directories for security and build context isolation reasons. The developer tries to use symlinks, which also fail because Docker resolves symlinks within the context but cannot follow them outside of it. The actual fix requires running the build from the monorepo root, passing the specific Dockerfile path with -f, and adjusting the COPY instruction to COPY libs/shared /app/shared.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T04:28:24.462746+00:00— report_created — created