Running Docker on two hosts, bridged with Open vSwitch
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.
Setup
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.
Route
See the other Gist using Tinc to solve a problem where Docker allocates the same IP addresses on both hosts.
Useful debugging commands
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 am trying to get a multiple host docker setup and have followed you blog post "http://goldmann.pl/blog/2014/01/21/connecting-docker-containers-on-multiple-hosts/" and also this gist
Based on that I am able to ping the containers from each host [and across the host], so network connectivity between the different containers spread over the 2 hosts seems to work properly. [PS: My Host is Ubuntu 14.04 and my docker version is Docker version 1.0.1, build 990021a
After that I setup some containers and here is what I observe, kindly let me know if I am missing something or is this a limitation of the setup.
When I try ssh from one container from Host A to another container on Host B, or just try to ssh from Host A to any container on Host B, the ssh seems to be stuck. A typical output looks like this
After that it is stuck at that point.
More importantly I see the same issues on different application similar to SSH.
you response and any feedback/guideline would be really great and appreciated.