Docker Community Forums

Share and learn in the Docker community.

Docker (>1.12) swarm storage options with DAB (distributed application bundles) on GCE

beta
docker

(Nick Thomas) #1

Hi there!

We’ve just setup a swarm on GCE (google compute engine) with docker 1.12-rc2 and successfully ran our first services via:

$local_machine: docker-compose bundle
$swarm_manager1: docker deploy someservice

The whole setup with load-balancing works quite nicely and was really fast to setup.

We are now faced with the task of how to make data containers with persistent storage work, since we’d like to setup multiple postgres, rabbitmq and elasticsearch instances (and don’t want to lose our data,…).

As I understand:

docker-compose bundle

currently does not support volumes. So I think that flocker is not an option (not sure though).

So my question is:

  • What approaches are there to get persistent storage in a swarm when using bundle/deploy with *.dsb/*.dab files?

The “smartest” I could come up with so far is to mount NFS shares inside the containers, like it is done here.

I would be very grateful if somebody could nudge me in the right direction. :whale:


(Mvdstam) #2

This is really good question. The whole DAB idea seems awesome, but kind of useless if the services created can’t access each others files (or, like you stated, have some kind of persistent storage).

Then again, docker stacks and DAB is highly experimental at this stage, so probably it’s still being worked on!


(Nick Thomas) #3

ok, we have a kind of working solution right now using nfs and volume mounting.

nfs setup

we have one instance on GCE ‘nfs’ that serves an nfs share, currently:

/srv/nfs

i created a swarm-tempate image that already has the nfs mount in the /etc/fstab.

service create *

to create a service with a ‘volume’ (old syntax) or ‘mount’ as it seems to be called now, we can now do:

docker service create --name postgres -p 5432:5432/tcp -m type=bind,source=/mnt/nfs/postgres,target=/var/lib/postgresql/data,writable=true postgres:9.5

since the nfs share is mounted on each worker it works ™.

i guess this is not the most elegant solution, but it seems to work for now, will write an update if we experience problems.

we’ll check if we can get mounts into our dsb/dab files next.