Docker persistent storage across hosts?

I am working on a Vagrantfile to set up a cluster of 3 Ubuntu 16.04 hosts for dev with Docker. Two of the requirements are:

  • For each node make sure you attach 2 new “block devices” as this will be needed for creating pools of persistent storage across hosts
  • Setup a persistent storage solution across the docker hosts to make sure data is never lost in the event of container failures or cross-host rescheduling.

I’m not an expert on Docker persistent storage across hosts. The first requirement is easy, I use the VirtualBox provider and createHD to create two VDI’s per host if they don’t already exist and then storageAttach to make them visible on the host. If they are new I mkfs.ext4 (or ??? I’m open to using other filesystems), create mount points and mount. Done.

The second requirement is the one that is kicking my butt. I know how to create volumes for attachment to containers, but across hosts? I looked at a few storage plugins but the only one I found that supported multihost is Flocker and it’s dead as a doorknob – the company folded and the Github project hasn’t been touched since last year.

If would be great if someone could point me to a plugin with clear instructions on how to set it up, or to another solution? Short of setting up a fourth host with two HD’s and using NFS to share across the other three hosts, I’m not sure what to do here.


https://ender74.github.io/Sharing-Volumes-With-Docker-NFS/

might help :slight_smile:

–Siju

Thank you for the reply. It does help, but not if I am trying to implement a pool of persistent storage using local devices in each host. I have a feeling this requirement may be beyond the scope of what Docker can do, or what is recommended (I could make a mess and export NFS mounts from each host, but that’s a really bad idea, IMO…) :slight_smile:

1 Like

Looks you have 2 requirements. 1) the high available volume on the commodity nodes that could be accessed from different nodes. Not for the concurrent access, but when the container moves to another node, could access the volume. 2) the ability to move the volume with container.

The plugin such as flocker, REX-Ray, could only help on #2. For #1, you could consider the open source software, such as GlusterFS. GlusterFS also has docker volume plugin, https://github.com/calavera/docker-volume-glusterfs. Not tried it. Probably it could solve both #1 and #2.

If you are going to deploy on AWS, EBS will be a good candidate for #1.