How to share data between container (same service)

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)