Disk image as volume

Hi folks! It’s my first post here so please be kind :slight_smile:

I’m trying to find a way of mounting disk images to my Docker containers without requiring root on the host machine (meaning I can’t mount them to the host first).

I haven’t settled on an image type yet, but I’m looking at squashfs, or perhaps something a bit more basic (see http://linuxgazette.net/109/chirico.html).

The closest I’ve got is by using -v to make the image file available to the container and then using CMD to mount the image once the container starts. But that isn’t quite what I want as I’d like to use CMD to run the application logic which depends on the data in the disk image.

Extracting the disk image to the host before starting the container could result in unacceptable overhead for large images.

Using a Docker container as a kind of image and mounting via the volumes-from flag isn’t tenable as these images need to be usable in non-docker environments as well.

I’ve looked at a few volume drivers, but haven’t been able to find anything which does quite what I need.

Do you guys have any ideas on how I can achieve this? Or do I just have to suck it up and write my own volume driver/do domething else completely?

Thanks!

Mark.