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>
Recently got a mail from Caleb Crane who faced the same issue and apparently has solved the issue. Am quoting it here, so that the rest of us can use it if faced with the issue. The solution and all credits go to Caleb Crane.
"
I got it working in my environment. It turned out to be necessary to set the MTU to 1420 in the containers. GRE doesn’t support fragmentation so when ssh tried to send a frame at 1500 bytes the client wasn’t receiving the entire thing.
"