1

I created a service in docker swarm with a bind volume in specific path. If i scale up , will docker create a new service with a new bind volume (with same path) in the second machine?

  • Not enough information, depends on the volume path and driver. If you use the native driver and map multiple nodes/containers to a nfs mounted volume the only concern is file locks, otherwise check out alternative storage drivers that are designed to share a common persistent backed. If you're spinning up multiple processes that require persistence you should be looking into alternative storage options like redis/rabbitmq or postgres or etc.... – Jacob Evans Jun 23 '18 at 15:18

1 Answers1

0

Yes. Why not just try it and see? This is one of the reasons you usually wouldn't use the default 'local' driver in Swarm. I never recommend bind-mounts in Swarm because it implies something "special" on that node like local/mounted storage configured on the host OS. REX-Ray is a good open-source docker volume driver option, and there are many other volume plugins at store.docker.com.

Bret Fisher
  • 3,973
  • 2
  • 21
  • 25
  • Ok , in my case every node has its disk , volume is mounted in the same path for every node. I prefer bind volumes because all bind volumes are in a parent folder. So if i need to export data i can make it exporting the parent folder, in the same time every volume is associated to a autoexplicative path so it is simple to work in the volumes also from host. – Mark Lender Jun 24 '18 at 12:07