Skip to content

Bridges and veth pairs: how containers share a network

Select an icon to see what it is.

Step 3 of 6

api joins the same way

api gets its own veth pair, plugged into the same bridge, with 172.18.0.3 on its eth0. Both containers are now ports on one virtual switch. They are on one subnet, so they need no router between them.

$ docker run -d --name api --network shop-net <image>

Container side (inside api's network namespace)

eth0 172.18.0.3/16 MAC 02:42:ac:12:00:03