`COPY failed: file not found in build context or excluded by .dockerignore: stat app.jar: file does not exist`
BeginnerTroubleshootingBuild failures and cache problems
Answer
Likely causes → File not built yet, path relative to wrong context, or .dockerignore excludes it (*.jar, target).
Diagnose →
cat .dockerignore
docker build --progress=plain .
ls target/
Fix → Build artifact first or use multi-stage, fix path, add !target/app.jar exception.
Prevent → Use multi-stage builds so artifacts come from a prior stage.
More on Build failures and cache problems
`failed to solve: process "/bin/sh -c apt-get install -y curl" did not complete successfully: exit code: 100` with `E: Unable to locate package curl`Beginner`E: Failed to fetch http://deb.debian.org/... 404 Not Found` during build of an old image.Intermediate`ERROR: failed to solve: failed to compute cache key: "/requirements.txt" not found: not found`BeginnerBuild hangs at `RUN pip install ...` or `npm install` and eventually times out.Intermediate`failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: dockerfile parse error on line 12: unknown instruction: RUNN`BeginnerBuild works locally but fails in CI with `exec format error` in a `RUN` step.Intermediate