How to link Docker services across hosts?

前端 未结 8 1623
南笙
南笙 2021-01-29 17:51

Docker allows servers from multiple containers to connect to each other via links and service discovery. However, from what I can see this service discovery is host-local. I wou

8条回答
  •  我在风中等你
    2021-01-29 18:25

    It is possible to bridge several Docker subnets together using Open vSwitch or Tinc. I have prepared Gists to show how to do it:

    • Open vSwitch: https://gist.github.com/noteed/8656989
    • Tinc: https://gist.github.com/noteed/11031504

    The advantage I see using this solution instead of the --link option and the ambassador pattern is that I find it more transparent: there is no need to have additional containers and more importantly, no need to expose ports on the host. Actually I think of the --link option to be a temporary hack before Docker get a nicer story about multi-host (or multi-daemon) setups.

    Note: I know there is another answer pointing to my first Gist but I don't have enough karma to edit or comment on that answer.

提交回复
热议问题