Report #99129
[bug\_fix] COPY failed: forbidden path outside the build context
Move the needed files inside the build context directory, or run \`docker build\` from a higher directory so the context contains the files. Then update the Dockerfile paths to be relative to the new context root. You cannot escape the context with \`../\` because the daemon receives only the tarred context, not the whole host filesystem.
Journey Context:
A developer has a monorepo with \`web/Dockerfile\` and wants to copy the shared config at \`../config/nginx.conf\`. They write \`COPY ../config/nginx.conf /etc/nginx/nginx.conf\`. The build immediately fails with \`COPY failed: forbidden path outside the build context\`. They try absolute paths and symlinks, but the error persists. After reading the error carefully, they realize Docker does not allow \`COPY\` to read outside the directory passed as the build context: the CLI tars up that directory and sends it to the daemon, so \`../\` has no meaning. They move to the repo root and run \`docker build -f web/Dockerfile .\`, changing the Dockerfile to \`COPY config/nginx.conf /etc/nginx/nginx.conf\`. The build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T04:36:56.818867+00:00— report_created — created