How to share data between container (same service)

I run an apache service on 3 nodes using swarm :
docker service create --name my-apache --publish 8081:80 --replicas 3 apache-php

Users of my web site upload pictures and I want to share this data between all the apache container.

Is there a way to use Data Volume Container to do this ?
I see the --mount option in service create but donā€™t find documentation about it.
I see that a ā€œglobalā€ mode exist for data volume (here) but donā€™t find any information.

could you help me solving my problem ?

David

I find this discussion (without really answer in it :frowning: ) about my problem :

Thereā€™s Flocker (https://clusterhq.com/flocker/introduction/) which is a volume plugin for Docker that persists/replicates data across all of the nodes in the cluster, so it doesnā€™t matter in which node your process is allocated, it will have the data available.

You might want to check that out.

Thanks.
I fonud btsync also (http://blog.bittorrent.com/2013/10/22/sync-hacks-deploy-bittorrent-sync-with-docker/).

So I create service for btsync :
docker service create --mount type=volume,source=hello,target=/data ā€¦

and use the volume for my apache :
docker service create --name demo --mount type=volume,source=hello,target=/var/www/html/ ā€¦

Not sure what your app/site is, but have you considered AWS S3 rather than local storage? It is a simple API. If this is just a personal project, you may not want this.

For a small number of containers, you can create a single volume that is mounted by multiple containers through a standard mount point, and eliminate the traffic/load of syncing files.

  1. docker create -v /data --name datavol1 <generic_base_image> /bin/true
  2. docker run -d --volumes-from datavol1 --name my-apache --publish 8081:80 --replicas 3 apache-php

(you donā€™t need to start the container created in the first step, just the shared resource)