Docker Container Mount Volume to Hosts Mounted Network Share

docker

I have a Docker host that has a mounter network share to a folder on the host /mnt/share/folder the share works just fine. I need to be able to mount this share on the host to the container. I tried -v /mnt/share/folder:/folder and when I start the container it tells me that I cannot write to the location.

Basically, the share has files that I want to be able to read/write from the container. I need the container to be able to create files/folders to the share.

I have also tried --mount type=bind,source=/mnt/share/folder,target=/folder and Docker will not build the it.

Best Answer

I would recommend mounting the share to the container using the docker nfs volume plugin directly

$ docker volume create --driver local \
--opt type=nfs \
--opt o=addr=192.168.1.1,rw \
--opt device=:/path/to/dir \
foo
Related Topic