This Gist shows how to use Open vSwitch to bridge Docker containers on two hosts. It is based on this blog post http://goldmann.pl/blog/2014/01/21/connecting-docker-containers-on-multiple-hosts/.
A similar Gist using Tinc instead of Open vSwitch is available: https://gist.github.com/noteed/11031504.
To prepare a host (e.g. a new Digital Ocean Ubuntu 14.04 droplet), simply run
the install.sh
script:
# wget https://gist.githubusercontent.com/noteed/8656989/raw/install.sh
# sh install.sh
Once done, the two first variables of the shared-docker-network.sh
script
must be changed, and the script can be run:
# vim shared-docker-network.sh
# sh shared-docker-network.sh
Repeat the steps on a second host.
See the other Gist using Tinc to solve a problem where Docker allocates the same IP addresses on both hosts.
root@node-1:~# ip a s
root@node-1:~# ip r s
root@node-1:~# brctl show
root@node-1:~# ovs-vsctl show
root@node-1:~# ping <other host>
root@node-1:~# ping <other host bridge>
I can confirm that --mtu=1420 is required.