不同的Docker 1.9网络相互通话? [英] Different Docker 1.9 networks talk to each other?
问题描述
现在你的三个节点被配置为使用键值存储,您可以在任何节点上创建覆盖网络。当您创建网络时,它将分发给所有节点。
当您在任何主机上创建第一个覆盖网络时,Docker还会在每个主机上创建名为 code> docker_gwbridge 。 Docker使用此网络为容器提供外部访问。
覆盖网络中的每个容器也可以获得一个
eth
在docker_gwbridge
中,允许容器访问外部世界。
$ code> docker_gwbridge 是类似的到Docker的默认桥梁
网络,但与桥梁
不同,它限制了集装箱间通信(ICC)。
Docker每个主机只创建一个docker_gwbridge
桥接网络,无论存在的覆盖网络数量如何。
Docker为属于RED覆盖网络的每个容器添加了一个条目到
/ etc / hosts
。
因此,要达到container2
从container1
,您只需使用其名称即可。 Docker自动更新/ etc / hosts
,当容器连接并从覆盖网络断开连接时。
此时,
container2
和container3
可以通过RED
覆盖网络。
它们都位于相同的docker_gwbridge
上,但无法通过主机端口映射进行通信。docker_gwbridge
用于所有其他流量。
I want to create two Docker 1.9 networks. Network A runs a web server, an application server, and a Postgres server (all containers). Network B runs a SMTP server and other containers. I need containers on Network A to get to Network B. Is it possible?
The libnetwork implementation includes an overlay mode:
The overlay driver implements networking that can span multiple hosts using overlay network encapsulations such as VXLAN. For more details on its design, please see the Overlay Driver Design.
The new native overlay network driver supports multi-host networking natively out-of-the-box.
This support is accomplished with the help of libnetwork, a built-in VXLAN-based overlay network driver, and Docker's libkv library.
This tutorial explains how to make containers talk to each other even if they are on different machines, provided they are registered to the same overlay network.
That will involve setting up first a K/V (Key/Value) store:
Now that your three nodes are configured to use the key-value store, you can create an overlay network on any node. When you create the network, it is distributed to all the nodes.
When you create your first overlay network on any host, Docker also creates another network on each host called
docker_gwbridge
. Docker uses this network to provide external access for containers.Every container in an overlay network also gets an
eth
interface in thedocker_gwbridge
which allows the container to access the external world.
Thedocker_gwbridge
is similar to Docker's defaultbridge
network, but unlike thebridge
it restricts Inter-Container Communication(ICC).
Docker creates only onedocker_gwbridge
bridge network per host regardless of the number of overlay networks present.Docker added an entry to
/etc/hosts
for each container that belongs to the RED overlay network.
Therefore, to reachcontainer2
fromcontainer1
, you can simply use its name. Docker automatically updates/etc/hosts
when containers connect and disconnect from an overlay network.
At this point,
container2
andcontainer3
can communicate over theRED
overlay network.
They are both on the samedocker_gwbridge
but they cannot communicate using that bridge network without host-port mapping. Thedocker_gwbridge
is used for all other traffic.
这篇关于不同的Docker 1.9网络相互通话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!