Common causes
- The path in COPY or ADD doesn't exist in the build context directory
- A multi-stage build references a file from a previous stage that wasn't copied or created
- The build context (the . in docker build .) doesn't include the file — check the working directory
- A typo in the file or directory name in the Dockerfile COPY instruction
How to fix it
- Check the file path in your COPY instruction against the actual file structure in your project
- Run ls in the build context directory to confirm the file exists: ls -la src/
- For multi-stage builds, make sure the previous stage creates or copies the file: COPY --from=builder /app/dist ./dist
- Review .dockerignore to ensure the needed files aren't excluded
Example
$ docker build .
#5 [2/3] COPY dist/ /app/
#5 ERROR: failed to solve: failed to compute cache key: "/dist": not foundBuildKit can't find the dist/ directory — it wasn't created yet or doesn't exist in the build context
Browse more errors
The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.
