docker build cannot find the Dockerfile it was told to use
unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttributesExShort answer
docker build looks for a file named Dockerfile at the root of the build context, the folder you pass as the last argument. Both errors mean no file was found where Docker looked. Run the build from the folder that holds the Dockerfile, or pass the context folder and the -f flag so they match what is on disk.
Fix it fast
1Find out which cause you have
List the folder you are building from, and look for a file called exactly Dockerfile. The context is the last argument of the command, so print the command you ran next to it.
ls -la # Windows PowerShell: dir docker build .2Match what you see, then jump to its fix
What does the error look like?
unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttributesExERROR [internal] load build definition from Dockerfile
Cause 1 of 2
There is no file named Dockerfile at the root of the context
1Check
Docker only looks for PATH/Dockerfile when -f is not given. A file named dockerfile.txt, Dockerfile.dev or a Dockerfile inside backend/ is not found unless you say so.
ls -la2Fix
Go to the folder that contains the Dockerfile and build there, or pass that folder as the context.
cd backend
docker build -t my-app .
# or, from the parent folder
docker build -t my-app backend3Verify
The build now starts reading the Dockerfile instead of stopping at once.
docker build -t my-app .Confirmed by docs.docker.com
Cause 2 of 2
-f points at a file that is not where you typed it
1Check
-f selects a Dockerfile other than the default. Check the spelling and the path you gave it, and which folder you ran the command from.
docker build -f docker/app.Dockerfile -t my-app .
ls docker/app.Dockerfile2Fix
Correct the -f value to a file that exists, and keep the context argument as the folder the COPY lines expect.
docker build -f docker/app.Dockerfile -t my-app .3Verify
The command moves past load build definition and starts the first step.
docker build -f docker/app.Dockerfile -t my-app .Confirmed by docs.docker.com
How do I stop it coming back?
- Keep one Dockerfile at the repository root, or write the -f path into your Makefile or CI step so nobody types it by hand.
- Build from the folder you intend to use as the context, and print that folder in CI logs.
- On Windows, turn on file extensions in Explorer so a Dockerfile is not saved as Dockerfile.txt.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Servers
apk cannot find py-pip in an Alpine Docker image
py-pip (no such package):
On current Alpine releases there is no package called py-pip.
2 causes, each with a fixServers
ng serve runs in the container but localhost:4200 does not open
The browser cannot open localhost:4200 although ng serve is running in the container
ng serve listens on localhost by default, which inside a container is the container itself.
3 causes, each with a fixServers
Angular routes return 404 from nginx when you refresh or open a link
The home page loads, but refreshing /some/route shows an nginx 404
Angular routes like /users/42 are not files, so nginx looks for them on disk and returns 404.
3 causes, each with a fixServers
AH00558: Apache in Docker cannot reliably determine its fully qualified domain name
Set the 'ServerName' directive globally to suppress this message
AH00558 is a warning, not a crash.
2 causes, each with a fixServers
Apache in a Docker container logs AH01114 when it proxies to a backend
AH01114: HTTP: failed to make connection to backend: api
Apache's proxy worker could not open a connection to the address in ProxyPass.
5 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fix