ProjectStack
docker

failed to read dockerfile: open /var/lib/docker/tmp/…/Dockerfile: no such file or directory

Docker started the build but can't find a Dockerfile in the build context or at the path you specified. Either the file doesn't exist, it's named differently (wrong case on case-sensitive filesystems), or you need to tell Docker where to find it.

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

  1. Confirm the Dockerfile exists in the current directory: ls -la | grep -i dockerfile
  2. Specify the Dockerfile path explicitly: docker build -f path/to/Dockerfile .
  3. Fix the filename casing on Linux: mv dockerfile Dockerfile
  4. 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 directory

Running 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.