Docker Community Forums

Share and learn in the Docker community.

Docker 1.12 swarm + shared volumes


(Rossdargan) #1

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!)


(Dvohra) #2

Create a global volume.


(Rossdargan) #3

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!


(Jon Busby) #4

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!!!


(Valentinnc) #5

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 ?


(Ekambaram) #6

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


(Dcnl1980) #7

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?


(Archimedes Trajano) #8

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