Using docker volume with a NFS partition

强颜欢笑 提交于 2019-12-10 15:55:32

问题


I have a NFS partition on the host, if add it to a container with

docker run -i -t -v /srv/nfs4/dir:/mnt ubuntu

/mnt will contain the shared data, but doesn't it cause conflicts? Since it hasn't been mounted with nfs-client?


回答1:


Docker uses bind mounts to share host directories with containers. Docker handles namespace permission so that the container can access the mount. Otherwise from the host's perspective, the bind mounted NFS share is just being accessed by another process. It's safe to bind mount an NFS share elsewhere on the filesystem. Using it from within a Docker container is no different.




回答2:


As of Docker 1.7+ you can use a Volume Plugin. See the Docker Volume Plugin section for details.

As far as NFS goes you can use the Docker Netshare plugin which handles mounding NFS, CIFS and AWS EFS file systems.




回答3:


You have to share /srv/nfs4/ in your default docker machine. Go to virtualbox > default (or boot2docker) > settings > Shared Folder



来源:https://stackoverflow.com/questions/20581678/using-docker-volume-with-a-nfs-partition

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!