Docker 1.12 swarm + shared volumes

I’m really excited by docker swarm 1.12, and have all the hello world samples running great. What I’d like to do is now add a stateful container into the mix, but I can’t figure out how to create a shared volume all the containers can see.

Is there any documentation anywhere about this, or perhaps a sample somewhere? Or can someone even just tell me what parameter I should be looking out for (I’m guessing it’s probably docker service create --mount … but I’m a bit lost past that!)

Create a global volume.

Thanks - I’m heading down that route. I think the command should probably look something like this, but I can’t quite get the syntax totally right

docker volume create --driver=local -o=type=cifs --opt o=username=USERNAME o=password=PASSWORD -o=addr=//server/share

But basically none of the above works!

This is exactly the problem I’m having also (see my most about a container that “lost” its state when it was rebalanced between nodes).

Once we solve this problem (and external DNS - so no need for interlock etc), Docker Swarm will rule the world!!!

Hi ! I have the same problem, I want to use a service with a volume based on each node (replicated with GlusterFS) but ‘service create’ don’t allow to add ‘-v’. How to do this ?

try something like below command for redis

docker service create
–name=redis
–mount=type=volume,volume-driver=glusterfs,src=redis-data,dst=/var/lib/redis
redis:latest

I tried that with redis, but it’s not working in my swarm. What I was thinking is it possible to run glusterfs in a swarm, since swarm have an overlay network and it would be great to share replicated volumes between swarm clusters. Anyone have an idea to fix this?

If you do this approach then you’d need the glusterfs client in your other containers to access it.