简体   繁体   English

如何在 OSX 上将卷挂载到 docker?

[英]How to mount volume to docker on OSX?

I have a problem mounting a host machine volume to a docker image.我在将主机卷安装到 docker 映像时遇到问题。 I've added a folder to docker File sharing settings, but it doesn't get any effect.我在 docker 文件共享设置中添加了一个文件夹,但是没有任何效果。 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 桌面的文件共享设置中的卷,但出现权限被拒绝错误

~$ 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: Docker 桌面截图:

卷已添加到 docker 桌面的文件共享设置中

Solution prvided by François Alexandre Docker: Mounts denied. François Alexandre Docker 提供的解决方案:安装被拒绝。 The paths... are not shared from OS X and are not known to Docker 路径...不是从 OS X 共享的,并且不为 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.使用新版本 3.0.0 的 Docker for mac,您需要在 Preferences>Experimental Features 中禁用使用 gRPC FUSE 进行文件共享。

You have overlapping directories.您有重叠的目录。 I suggest only exporting /Users/username directories and avoid /Users我建议只导出/Users/username目录并避免/Users

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM