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.
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.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.