Docker: how to connect two bridges

来源:互联网 发布:淘宝组装机为什么便宜 编辑:程序博客网 时间:2024/06/06 02:15

http://stackoverflow.com/questions/36544443/docker-how-to-connect-two-bridges


1 down vote favorite 

As you know after Docker 1.9 we can create bridges to connect containers.

I have created two custom bridges: bridge A 172.18.0.1 and bridge B172.19.0.1.

Now I have a container1 on bridge A, and a container2 on bridge B called "mailServer".

The container1 needs to reach container2 by a DNS, how should I do this? Because they are on different bridges so they cannot talk to each other. Do I need a router and can I achieve this by Docker?

This is a new feature of Docker and I didn't find much information. Thanks.



You can try making use of the veth peer so that you can connect two bridges. Make sure you are rename and names respectively with the one you configured.

ip link add veth0 type veth peer name veth1ifconfig veth0 upifconfig veth1 upbrctl addif <D1-A-Bridge> veth0brctl addif <D2-A-Bridge> veth1
shareimprove this answer

0 0
原创粉丝点击