Docker Community Forums

Share and learn in the Docker community.

Mounting an ISO on top of an NFS volume

I have created an NFS volume, as shown:

docker volume create -d local -o type=nfs -o device=:/"$(pwd)"/myshare -o o=addr=host.docker.internal,rw mynfs

and started my container, as shown:

docker run --volume mynfs:/mnt/mymnt --privileged --name mount -it myimage bash

I have an ISO file within my docker image that I would like to mount at /mnt/mymnt so that the files within the ISO are usable from the host. Is this possible?

Simply mounting the ISO to /mnt/mymnt allows me to view the files from within the docker but not from the host (i.e. $(pwd)/myshare remains empty).

I can get this to work on a Linux host by using the docker volume mount option bind-propagation=shared but I’m trying to get it to work over NFS so I can use it on non-Linux hosts.

I think I see why this is happening. Apparently the NFS volume is mounted as a slave within the docker:

# findmnt -o TARGET,PROPAGATION /mnt/mymnt 
/mnt/mymnt   private,slave

So anything mounted within mnt/mymnt will not appear in $(pwd)/myshare (but it should the other way around).

Is there a way to change the docker’s NFS propagation to shared?