简体   繁体   中英

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?

One option is an Overlay Network such as weave . This is very easy to set up, lets containers 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 work on weave.

Why might 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 set up routes between bridges on different machines, and how to hide or change those IP addresses because they can't be used on the public internet.

You could just use the host's network, with the docker run command-line option --net=host , but this loses some of the encapsulation you get from containers.

There are active discussions going on about Docker network drivers which would make solutions easier to implement, but no code as yet.

Amazon have launched their own container clustering service which promises to let containers talk to each other, but again it's not available yet.

我发现使用Open vSwitch - https://goldmann.pl/blog/2014/01/21/connecting-docker-containers-on-multiple-hosts/是最简单的解决方案!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM