Docker Community Forums

Share and learn in the Docker community.

Docker networking between host and two containers connected by bridge network

I have two docker containers (A and B) that run on a host and are connected to it via a bridge network (network interfaces available at this point in both the containers are eth0 and lo). According to the design, I want to create a new interface in both A and B that connects to a VLAN interface on the host, say eth0.3001 (again via a separate bridge network). Let’s say this newly created interface appears as eth1 on A. I am required to run the zeroconf protocol (point-point) on eth1. Now, I start the point-point protocol on eth1 in A and the protocol assigns a link local IP address to it.

The container B also has an interface, let’s say eth2 connected to eth0.3001 on the host. I want to use the link local IP derived on eth1 (in container A) on eth2 (container B) as well. This is because, container B needs to send IP packets to the host’s peer (in the point-point network). Please see the image below.

[Point to Point Network][1] [1]:

What is the cleanest way to achieve this? Can I bind the IP address derived in container A to the interface in container B? Or should I just move the protocol in container A to B, so that interface on A is not required at all? Please do suggest. Thanks in advance.