Docker: unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttributesEx
Solution 1:
while executing following command:
docker build -t docker-whale .
check that Dockerfile is present in your current working directory.
Solution 2:
The error message is misleading. The problem has nothing to do with symlinks really. It is usually only that docker cannot find the Dockerfile describing the build.
Typical reasons are these:
- Dockerfile has wrong name.
It must be calledDockerfile
. If it is called, for instance,dockerfile
,.Dockerfile
,Dockerfile.txt
, or other, it will not be found. - Dockerfile is not in context.
If you saydocker build contextdir
, the Dockerfile must be atcontextdir/Dockerfile
. If you have it in, say,./Dockerfile
instead, it will not be found. - Dockerfile does not exist at all.
Sounds silly? Well, I got the above error message from my GitLab CI after I had written a nice Dockerfile, but forgotten to check it in. Silly? Sure. Unlikely? No.
Solution 3:
If you are working on windows 8 you would be using Docker toolbox. From the mydockerbuild directory run the below command as your Dockerfile is a textfile
docker build -t docker-whale -f ./Dockerfile.txt .
Solution 4:
The name of the file should be Dockerfile
and not .Dockerfile
. The file should not have any extension.
Solution 5:
- Make sure you moved to the directory where Dockerfile is located.
- Make sure your Dockerfile is extension-less. That is, not Dockerfile.txt, Dockerfile.rtf, or any other.
- Make sure you named Dockerfile, and not DockerFile, dockerfile or any other.