Docker Core
The builder could not locate a Dockerfile at the path the build referenced.
dockerfile-not-foundReviewed for reference consistency: August 11, 2026
The builder could not locate a Dockerfile at the path the build referenced.
What dockerfile-not-found Means
The dockerfile-not-found error on the Docker Core indicates the builder could not locate a dockerfile at the path the build referenced.. This typically occurs due to the dockerfile lives outside the directory the build ran from.
Every build names its Dockerfile, defaulting to a file of that name in the context root. When the file is absent, renamed, or sits in a subdirectory the flag does not point to, the solve step fails while reading the build definition with the no-such-file wording.
How to fix dockerfile-not-found
General informational guidance, not professional advice. Commands can affect your system or data — back up first and proceed at your own risk. FixerCode is an independent reference, not affiliated with any vendor mentioned.
List build definition files in the current directory
A directory listing shows which Dockerfile variants actually exist where the build will run from.
ls -1 | grep -i dockerfileShow the file flag the builder accepts
The build reference documents the file flag's default and accepted forms, framing the path the builder tried.
docker buildx build --help | grep -A2 -- '--file'
Technical Background
Reading the Dockerfile is the first thing a build does, so this failure precedes all image work: no context transfer completes, no layers build, and no cache matters yet.
The Dockerfile path and the build context are independent inputs: the file can sit outside the context directory in most setups, which resolves the common case of a repository-root build against a nested deploy folder.
Common Causes
- The Dockerfile lives outside the directory the build ran from
- The file was never committed or generated before the build stage
- The file flag's path does not match the actual filename
Typical Scenarios
- Building from the repository root when the Dockerfile sits in a deploy subfolder
- A CI checkout missing the file because it is generated in a prior stage
- A flag pointing at an old filename after a rename to a variant suffix
What to Know
Because the failure is about a single path, the check is narrow: the build's working directory and the file flag together determine where the builder looked, and a directory listing settles it immediately.
Frequently Asked Questions
Common questions about Docker dockerfile-not-found error
No. The file flag accepts any readable path; only the default assumes the context root, which is why nested layouts hit this error.
Generated Dockerfiles exist locally but not in CI checkouts, so the file the builder expects is a build artifact rather than a committed source.
Related Error Codes
Related Errors From Other Categories
Similar error codes documented across different platforms and systems