Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mount volume to docker on OSX?

I have a problem mounting a host machine volume to a docker image. I've added a folder to docker File sharing settings, but it doesn't get any effect. What do I have to do to solve the problem?

For example, I try to mount a volume which was added to File sharing settings in Docker Desktop, but I get permission denied error

~$ docker run --rm -it -v /Users/:/vm-root alpine ls -l /vm-root
docker: Error response from daemon: Mounts denied: EOF.
ERRO[0000] error waiting for container: context canceledenter code here

Docker Desktop Screenshot:

Volume already added to file sharing settings in docker desktop

like image 737
Mikhail Avatar asked Oct 11 '19 13:10

Mikhail


People also ask

Where does docker store volumes OSX?

As a Linux user, you learn that Volumes are stored in a part of the host filesystem managed by Docker, and that is /var/lib/docker/volumes . When you're running Docker on a Windows or Mac OS machine, you will read the same documentation and instructions but feel frustrated as that path don't exist on your system.

Can you mount a docker volume on the host?

You can mount host volumes by using the -v flag and specifying the name of the host directory. Everything within the host directory is then available in the container. What's more, all the data generated inside the container and placed in the data volume is safely stored on the host directory.

What is the difference between volume and mount in docker?

The most notable difference between the two options is that --mount is more verbose and explicit, whereas -v is more of a shorthand for --mount . It combines all the options you pass to --mount into one field. On the surface, both commands create a PostgreSQL container and set a volume to persist data.


1 Answers

Solution prvided by François Alexandre Docker: Mounts denied. The paths ... are not shared from OS X and are not known to Docker

With the new version 3.0.0 of Docker for mac, you need to disable use gRPC FUSE for file sharing in Preferences>Experimental Features.

like image 154
BrianC Avatar answered Oct 04 '22 21:10

BrianC