kubernetes kubernetes/networking
Core Idea
A Linux bridge is a virtual switch in the kernel, and Docker builds container networking on top of it:
docker0for the default network andbr-*bridges for custom ones.
- The Linux bridge interface and where its documentation lives.
- Docker Bridge: the default
docker0bridge.- Custom docker network bridges, shown with a named
br-example.
Linux Bridge Interface
networking:bridge
08. Docker Networking > Single host Bridge networks
The bridge interface allows system administrators to create multiple layer 2 networks on a single.
In other words, the bridge functions like a network switch between network interfaces on a host, seamlessly connecting them.
Docker Bridge
The two interfaces, docker0 and br-944b28187632, are both virtual bridges used by Docker, but they serve different purposes.
1. docker0 (Default Docker Bridge)
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:10:78:2b:c6 brd ff:ff:ff:ff:ff:ff
docker0is the default bridge created by Docker when it is installed.- It provides networking for containers using the default bridge network.
- Containers attached to
docker0can communicate with each other using private IPs in the172.17.0.0/16range. NO-CARRIERandstate DOWNindicate that no containers are currently running in the default bridge network.
2. br-944b28187632 (Custom Docker Network Bridge)
5: br-944b28187632: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:d7:c7:36:ae brd ff:ff:ff:ff:ff:ff
- This bridge (
br-944b28187632) is a user-defined Docker bridge network. - When you create a custom bridge network in Docker (
docker network create mynetwork), it generates a new bridge interface with a unique name (likebr-944b28187632). - Containers connected to this custom network can communicate separately from
docker0. NO-CARRIERandstate DOWNindicate no containers are currently using this network.