Mounting Datavolumes on another dockerhost

Reading “Learning Docker” from packt, they are creating in a certain chapter a datacontainer looking like this:

docker run --name datavol -v /data busybox:latest /bin/true

Then:

docker run -it --volumes-from datavol ubuntu:latest /usr/bin/bash

and you can use datavol as a dataholder. Keeping application en data seperated. Which is great.The only problem is, we are still on the same dockerhost. Question is (and if it is useful, it this is a request): Might it be possible in time to mount a datavol from another dockerhost (probably via weave or something like that) ?

This is a good idea, would certainly add a lot of flexibility to be able to specify where your data volumes live. For now, have you thought about using NFS or iSCSI for your entire /var/lib/docker directory? That way, ALL data is in remote storage.

That is a great idea, I was thinking in the line of setting up ambassedor-containers to deal with that (but I really haven’t tried it yet). Thanks for the reply.

One item I didn’t think about when using remote network storage for /var/lib/docker is SELinux. The SELinux label for a container volume should be svirt_sandbox_file_t, but I don’t know if NFS will have a problem with that.