我可以有一个容器链接到B容器。
然后我可以请参阅A的ENV变量中的B的IP地址和暴露的端口。
但是,如何找出A的ip地址wihtin B容器?
解决方案要从其他容器中找到一个容器,您可以使用服务发现机制,例如 SkyDock 。
Skydock - Docker的自动化服务发现Skydock监视停泊点事件容器启动,停止,死亡,杀死等,并将记录插入动态DNS服务器skydns。这允许在Docker容器内运行的服务进行标准DNS查询。
对于更复杂的情况,您的容器位于多个主机上,您需要一种将它们联网在一起的方式,请参阅 weave-dns (请注意,我在编织和编织dns上工作)。
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?
解决方案To find one container from another, you can use a 'service discovery' mechanism such as SkyDock.
Skydock - Automagic Service Discovery for DockerSkydock 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).
更多推荐
码头连接两个容器如何知道彼此的ip
发布评论