0

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
Yamuk
  • 750
  • 8
  • 27
  • Does the data have to be replicated? Were it me I would share the data using something like NFS if possible. You could set up another service in your swarm to host NFS. – benbotto Jan 08 '20 at 22:39
  • Well, I can manage with no replication on some configuration data, and use configs. However I want to try clustering nexus and a few other data related applications such as SQL. I was unable to use an NFS mount on Windows, because as these are Hyper-V guests without nested virtualization, I cannot mount Linux containers. I am not sure if it would work if they were not virtualized either since Windows does not support volume plugins. – Yamuk Jan 08 '20 at 22:45

1 Answers1

1

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

  • They fixed many things from the old server versions. I was hoping this could also be fixed. I was unable to mount the shared folder either, though this may be because I can't have moby and LCOW on Hyperv in my configuration. Seems like some sort of file sync solution outside docker could be used. – Yamuk Jan 09 '20 at 02:15