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