Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: unable to prepare context: unable to evaluate symlinks in Dockerfile path: GetFileAttributesEx

while executing following command:

docker build -t docker-whale .

check that Dockerfile is present in your current working directory.


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 called Dockerfile. If it is called, for instance, dockerfile, .Dockerfile, Dockerfile.txt, or other, it will not be found.
  • Dockerfile is not in context.
    If you say docker build contextdir, the Dockerfile must be at contextdir/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.

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 .

The name of the file should be Dockerfile and not .Dockerfile. The file should not have any extension.


I had named my file dockerfile instead of Dockerfile (capitalized), and once I changed that, it started processing my "Dockerfile".


  1. Make sure you moved to the directory where Dockerfile is located.
  2. Make sure your Dockerfile is extension-less. That is, not Dockerfile.txt, Dockerfile.rtf, or any other.
  3. Make sure you named Dockerfile, and not DockerFile, dockerfile or any other.

Just Remove the extension .txt from Dockerfile and run the command

docker build -t image-name 

It will work for sure.