Report #99611
[bug\_fix] COPY fails with 'Forbidden path outside the build context' or silently strips \`../\` from COPY source paths
Restructure the project so all files needed by \`COPY\` or \`ADD\` live under the build-context root, or invoke the build from a parent directory and point to the Dockerfile with \`-f\`. Never rely on \`COPY ../something\` working.
Journey Context:
A team keeps their Dockerfiles in \`docker/\` and application source in \`src/\`. They write \`COPY ../src /app\` and the builder rejects it with a forbidden-path error. Some older builders silently collapse \`../\` and copy an empty or wrong path, causing even weirder runtime errors. After reading the Dockerfile reference they realize COPY/ADD sources are always resolved relative to and restricted by the build context. They move the build invocation up one level and run \`docker build -f docker/Dockerfile .\` from the project root, then change the instruction to \`COPY src /app\`. Now the context contains \`src/\` and the build succeeds.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:45:49.215855+00:00— report_created — created