docker linking how can both containers know each o

2019-07-21 07:54发布

问题:

From the docker linking

I can have A container links to B container.

Then I can see the B's ip address and exposed port in A's ENV variables.

However, how can I figure out A's ip address wihtin B container?

回答1:

To find one container from another, you can use a 'service discovery' mechanism such as SkyDock.

Skydock - Automagic Service Discovery for Docker

Skydock monitors docker events when containers start, stop, die, kill, etc and inserts records into a dynamic DNS server skydns. This allows standard DNS queries for services running inside docker containers.

For the more complex case where your containers are on multiple hosts and you need a way to network them together, see weave-dns (Please note I work on weave and weave-dns).



标签: docker