Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker building issue: Error checking context: can't stat

I am running docker file on my repository but unknown issue was come up. I wrote docker build . to the terminal but it said error checking context:

can't stat '/media/dev/Data/Project/.../src'

I'm not sure what the reason is and how to get out of this risk. Anybody can help me?

like image 382
U_M Avatar asked Aug 24 '26 00:08

U_M


1 Answers

I had a similar issue until recently . On 18.04, Ubuntu installs Docker via Snap.

By default, SNAP packages are not allowed to access /media, or any other / root folder. The SNAP sandbox will deny access unless you have explicitly granted access to removable-media. ( /mnt or /media )

To grant docker access to removable-media:

sudo snap connect docker:removable-media

Alternatively, move your project into your /home/user directory and try building from there.

like image 113
Zeppz Avatar answered Aug 26 '26 23:08

Zeppz