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:
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With