Using docker volume with a NFS partition

s1na picture s1na · Dec 14, 2013 · Viewed 7.8k times · Source

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?

Answer

Ben Whaley picture Ben Whaley · Feb 20, 2014

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.