2

Is there any way to mount an ISO contained in a Docker so that the contents of the ISO are available to the host machine?

I can do this on a Linux host by using a bind mount with shared as the bind propagation setting and then mounting to the shared folder within the Docker.

Starting container:

docker run -v /mnt/myiso:/mnt/myiso:shared --privileged mydocker

Inside container:

mount myimage.iso /mnt/myiso

Unfortunately shared bind propagation is only available on Linux hosts. I would like this to work on macOS and Windows hosts as well.

I thought perhaps an NFS share would enable it but I haven't been able to get that to work (the NFS volume is always mounted with slave propagation within the container).

  • Do you need --privileged? – ctrl-alt-delor Apr 18 at 13:56
  • @ctrl-alt-delor I believe you can use more fine-grained access rights than --privileged to enable a docker to mount an ISO but I can trust the docker image so I'm not too concerned. – mark Apr 18 at 15:21
  • I don't understand why you need a docker container with an iso file inside. Build a multi stage docker image doing iso content extraction in a folder at first stage, and copy the contents to a predefined host volume at last stage in the entrypoint. – Chaoxiang N Apr 30 at 4:05
  • @ChaoxiangN the ISO is not available at docker build time (it's on a shared drive mounted by the docker) and the contents of the ISO would take too long to extract. It needs to be mounted so the host has random access. – mark Apr 30 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.