更新时间:2023-11-28 19:00:04
您不能挂载HOMEDIR〜/之外的任何文件夹,这是在Mac和Windows虚拟机限制。当VirtualBox是创建它装入你的用户目录中,这使得它提供给容器的 https://github.com/docker/kitematic/issues/1192
在默认情况下,机器只会将你的home目录。如果你想添加更多,你需要使用VirtualBox的UI添加它们。
https://github.com/docker/machine/issues/1814
I tried to mount folder of my project from /var/www to the same folder in container but folder in container is empty. Problem is maybe with host folder permissions because if i try that with some other folder it works.
This works:
docker run -it -v ~/Downloads:/var/www debian:jessie /bin/bash
This doesn't work:
docker run -it -v /var/www:/var/www debian:jessie /bin/bash
You cannot mount any folders outside your homedir ~/, this is the VM restriction on Mac and Windows. When the Virtualbox is created it mounts the folders within your Users directory, which makes it the only folder available to the containers https://github.com/docker/kitematic/issues/1192
By default, Machine will only share your home directory. If you want to add more, you need to add them using the VirtualBox UI. https://github.com/docker/machine/issues/1814