How to share volumes across multiple hosts in docker engine swarm mode?

前端 未结 3 1357
既然无缘
既然无缘 2021-02-07 04:10

Can we share a common/single named volume across multiple hosts in docker engine swarm mode, what\'s the easiest way to do it ?

3条回答
  •  無奈伤痛
    2021-02-07 04:22

    From scratch, Docker does not support this by itself. You must use additional components either a docker plugin which would provide you with a new layer type for your volumes, or a sync tool directly on your FS which will sync the data for you.

    From my point of view, the easiest solution is rsync or more accurately lsyncdn the daemon version of rsync. But I never tried it for docker volumes, so I can't tell if it handle it fine. Other solutions are offered using Infinit.sh. It basically does the same thing as lsyncd does. It's a one way sync. So if your docker container are RW in their volumes it won't match your expectations. I tried this solution, and it works pretty well for RO operations. And not in production. It's still an alpha version. Infinit is also on the way to provide a docker driver. Not released yet. So I didn't even tried it. Too risky.

    Other solutions I found but was unable to install (and so to try) are flocker and glusterFS. Both are designed to create FS Volume based on several HDD from several machines. But none of their repositories were working these past weeks.

    Sorry for giving you only weak solutions, but I'm facing the same problem and haven't find yet a perfect solution.

    Cheers, Olivier

提交回复
热议问题