2

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?

runcode
  • 3,533
  • 9
  • 35
  • 52
  • 1
    possible duplicate of [How to create a bidirectional link between containers?](http://stackoverflow.com/questions/25324860/how-to-create-a-bidirectional-link-between-containers) – Usman Ismail Nov 20 '14 at 21:06
  • I didn't know "Then I can see the B's ip address and exposed port in A's ENV variables." so thanks for solving my problem, even though it was the question and not an answer. – Stephen O'Flynn Sep 03 '15 at 13:39

1 Answers1

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

Community
  • 1
  • 1
Bryan
  • 11,398
  • 3
  • 53
  • 78