unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /var/lib/snapd/void/Dockerfile: no such file or directory

Viewed 8187

I installed docker on Ubuntu with snap (snappy?), and then I ran this:

ln -sf /usr/bin/snap /usr/local/bin/docker

when I run docker build I get:

unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /var/lib/snapd/void/Dockerfile: no such file or

directory

5 Answers

I've got the same error using Ubuntu, and I noticed that I had installed the wrong Docker. Instead of (docker - transitional package) install (docker.io - Linux container runtime)

apt install docker.io

I ran into this same problem. I was setting up an Ubuntu server and elected to have Docker installed during the initial setup. It installed using snap, and as a result I couldn't run Docker in any directory outside of my home directory. This includes trying to Docker run any program in /var/. I fixed it by doing sudo snap remove docker and reinstalled using the official instructions in the Ubuntu docs:

https://docs.docker.com/engine/install/ubuntu/

I got this exact error message when I was running in /tmp/foo. When I switched the directory to /home/me/tmp/foo, The error went away.

Run docker cmd by root privilege, you can simply do it by using sudo

Uninstall snap docker version

snap remove docker

then restart and install again using apt / apt-get

apt-get install docker

this will install all symlinks related

Related