Marcos J.C Kichel
Marcos J.C Kichel

Reputation: 7219

How volumes are shared across Docker Swarm nodes?

So I'm starting to play with docker and docker swarm, and now I wonder how volumes are shared across docker swarm nodes.

Lets pick a Postgres database for instance, and I have a volume declared for the data:

docker-compose.yml:

...
  db:
    image: postgres:9.4-alpine
    volumes:
      - db-data:/var/lib/postgresql/data
    deploy:
      placement:
        constraints: [node.role == manager]
 ...

What If I have managers that are very far away, in different regions of the world, and occurs that they need to share data between them?

How does Docker operate on that?

Upvotes: 1

Views: 962

Answers (1)

Janshair Khan
Janshair Khan

Reputation: 2687

At first, creating a Swarm cluster compose of different regions is wiered and at some points, it is not even possible as TCP ports of different regions (or cloud vendors) may not allowed to connect with each other via the Internet which is an essential requirement for setting up a Swarm.

As far as sharing data is concerned, you have different options which you can choose from. For example you can use Azure File Storage or AWS EFS\EBS in your Docker containers via volume plugin mounts and storage, eventually, is shared across managers and workers in a cluster (distributed file-systems), you can use a volume orchestrator like Flocker volume plugin or setup your own NFS.

Upvotes: 1

Related Questions