Common causes
- The file is named dockerfile (lowercase) instead of Dockerfile on a case-sensitive Linux filesystem
- You're running docker build from the wrong directory — the Dockerfile is in a subdirectory
- The Dockerfile was accidentally excluded by .dockerignore
- The file simply doesn't exist yet
How to fix it
- Confirm the Dockerfile exists in the current directory: ls -la | grep -i dockerfile
- Specify the Dockerfile path explicitly: docker build -f path/to/Dockerfile .
- Fix the filename casing on Linux: mv dockerfile Dockerfile
- Check that .dockerignore doesn't exclude the Dockerfile itself
Example
$ docker build .
error: failed to read dockerfile: open /tmp/buildkit-mount123/Dockerfile: no such file or directoryRunning docker build . from a directory that contains a file named 'dockerfile' (lowercase) on Linux
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.
