Single-Host Bridge Networks
Learn how to create and manage single-host bridge networks in Docker for container communication.
Let’s look at single-host bridge networks and connecting to existing networks. You’ll also learn about overlay networks.
What is a single-host bridge?
The simplest type of Docker network is the single-host bridge network. The name tells us two things:
Single-host tells us the network only spans a single Docker host
Bridge tells us that it’s an implementation of an 802.1d bridge (layer 2 switch)
Docker creates single-host bridge networks with built-in bridge
driver. If you run Windows containers, you’ll need to use the nat
driver, but for all intents and purposes, they work the same.
Example
The figure below shows two Docker hosts with identical local bridge networks, both called mynet
. Even though the networks are identical, they are independent and isolated, meaning the containers in the picture cannot communicate, even if the nodes are part of the same swarm.
Every new Docker host gets a default single-host bridge network called bridge that Docker connects new containers to unless you override it with the --network
flag.
The docker network ls
command
The following commands show the output of a docker network ls
command on ...