Report #97652
[bug\_fix] COPY failed: file not found in build context or excluded by .dockerignore
Ensure the source path in COPY is relative to the build context \(usually the directory where docker build is run\). Check .dockerignore for unintended exclusions. Use absolute paths only if they are within the context.
Journey Context:
A developer ran \`docker build -t app .\` from the project root, but the Dockerfile had \`COPY ./src /app/src\`. The build failed because the \`src\` directory was outside the build context \(they had moved it\). They tried changing the COPY to \`COPY ../src /app/src\` which also failed because COPY cannot reference paths above the context. After reading the Docker docs, they realized the build context must include all files needed. They changed the build command to \`docker build -t app -f docker/Dockerfile .\` and adjusted COPY paths to be relative to the context root. They also discovered that a \`.dockerignore\` was accidentally excluding \`src\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-25T15:48:15.227364+00:00— report_created — created