user11612258
user11612258

Reputation:

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

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

Upvotes: 14

Views: 19154

Answers (6)

hanshenrik
hanshenrik

Reputation: 21513

doing

snap remove docker;
apt purge 'docker*';
apt install docker.io docker-compose-v2;

fixed it for me on Ubuntu 22.04 🤔

Upvotes: 1

otaneR ocraM
otaneR ocraM

Reputation: 61

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

Upvotes: 1

Winston Kotzan
Winston Kotzan

Reputation: 2087

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/

Upvotes: 28

Ali Faradjpour
Ali Faradjpour

Reputation: 360

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

Upvotes: 2

dirbacke
dirbacke

Reputation: 3019

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

Upvotes: 10

sjbrown
sjbrown

Reputation: 570

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.

Upvotes: 4

Related Questions