Fix:unable to prepare context: unable to evaluate symlinks in Dockerfile path

Sometimes when the command below is run :

docker build -t thebuildimage .

Notice the dot “.” at the end of the command (triggers the sending of the build context to docker daemon).

You will end up getting an error which looks like :

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /somepath/Dockerfile: no such file or directory

It might be that the Dockerfile (It must be named Dockerfile by the way) describing the build, may not exist in the same directory as that from which the build command is invoked.

According to Docker, the path (dot ”.” in the command above) indicates the location of the files which are related to the “context” of the build on the Docker daemon.

Read: How to run and manage a Docker container on Linux Ubuntu/Debian

From the official Docker documentation, one can read :

As stated above, Dockerfile may not be in the context since if the command reads :

docker build ctxtdir

The Dockerfile has to be defined at ctxtdir/Dockerfile.

Read: How to use symbolic links on Linux

If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.


Marianne elanotta

Marianne is a graduate in communication technologies and enjoys sharing the latest technological advances across various fields. Her programming skills include Java OO and Javascript, and she prefers working on open-source operating systems. In her free time, she enjoys playing chess and computer games with her two children.

Leave a Reply