How do I deploy a named data volume, with contents, to nodes in a swarm? Here is what I want to do, as described in the Docker documentation:
“Consider a situation where your image starts a lightweight web server. You could use that image as a base image, copy in your website’s HTML files, and package that into another image. Each time your website changed, you’d need to update the new image and redeploy all of the containers serving your website. A better solution is to store the website in a named volume which is attached to each of your web server containers when they start. To update the website, you just update the named volume.” (source: https://docs.docker.com/engine/reference/commandline/service_create/#add-bind-mounts-or-volumes)
I'd like to use the better solution. But the description doesn't say how the named volume is deployed to host machines running the web servers, and I can't get a clear read on this from the documentation. I'm using Docker-for-AWS to set up a swarm where each node is running on a different EC2 instance. If the containers are supposed to mount the volume locally, then how is it deployed to each node of the swarm? If it is mounted from a manager node as a network filesystem visible to the nodes, how is this specified in the docker-compose yaml file? And how does the revised volume get deployed from the development machine to the swarm manager? Can this be done through a deploy directive in a docker-compose yaml file? Can it be done in Docker Cloud?
Thanks