Reputation: 769
I am using Windows Server 2019 1809 on Hyper-V virtual machines. I have a small 2-node swarm with multiple replica services, and I am using volumes to store data. How can I replicate this data from my manager to the worker so that they are the same on both nodes? Apparently I cannot use any plugins for Windows machines. I can delegate the synchronization to Windows server or any other sync service. But I would like to know if I am missing something and if there is a way to synchronize volumes on both machines.
Here is a compose file as an example:
version: "3.7"
nexus:
image: myrepo/nexus:latest
volumes:
- nexus_data:C:\data
deploy:
placement:
constraints: [node.role == manager]
replicas: 2
networks:
- overlay-network
proxy:
image: myrepo/nginx-windows
ports:
- target: 80
published: 80
mode: host
volumes:
- type: volumes
source: nginx_data
target: C:/nginx/conf
networks:
overlay-network:
deploy:
mode: global
endpoint_mode: dnsrr
networks:
overlay-network:
external: true
volumes:
nexus_data:
external: true
nginx_data:
external: true
Upvotes: 0
Views: 358
Reputation: 512
I believe the currently recommended answer is to make the container responsible attaching to a shared folder instead of handling it as a docker volume. So you share a windows folder that the Hyper-V guests can access, and then the containers mount it as a mapped drive (or just point straight to the UNC path). There's some discussion about it here and here
Upvotes: 1