docker linking how can both containers know each o

2019-07-21 08:11发布

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?

标签: docker
1条回答
疯言疯语
2楼-- · 2019-07-21 08:20

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).

查看更多
登录 后发表回答