Ping docker containers on different hosts with IP addresses

I want to ping a docker container on host A (EC2 instance) from another docker container on host B (another EC2 instance). What are the steps I need to follow?

+3


source to share


2 answers


One option is an Overlay network like weave . It's very easy to set up, allows containers to talk to each other on different hosts or even different datacenters, and lets you choose what to connect and what to isolate. Please note: I am working on weaving.

Why do you need an add-on? As described in the docs , by default Docker creates a single host bridge and gives each container a private IP address. So now you have two problems: how to configure routes between bridges on different machines and how to hide or change these IP addresses because they cannot be used on the public internet.

You can just use the host network using the docker run

command line option --net=host

, but that loses some of the encapsulation you get from containers.



There is a lot of discussion about Docker network drivers that would make it easier to implement solutions, but there hasn't been any code yet.

Amazon launched their own container clustering service , which promises allows containers to talk to each other, but again it is not available yet.

+3


source


I found that using Open vSwitch - https://goldmann.pl/blog/2014/01/21/connecting-docker-containers-on-multiple-hosts/ was the easiest solution!



0


source







All Articles