Docker Networking Overview
What is Docker networking?
Section titled “What is Docker networking?”Every container gets a virtual network interface (NIC) when it starts. Docker connects that NIC to a network — a software-defined layer that controls which containers can talk to each other and to the outside world.
Without Docker networking, containers would be completely isolated islands. With it, you can wire together microservices, expose ports to the host, and segment traffic by environment — all without touching the host’s physical network configuration.
Network drivers
Section titled “Network drivers”Docker ships with four built-in network drivers. Each one trades off isolation, performance, and ease of use differently.
| Driver | Scope | Description |
|---|---|---|
bridge | Single host | Default driver. Creates a virtual switch (docker0) on the host. Containers on the same bridge can communicate; containers on different bridges cannot. |
host | Single host | Removes network isolation — the container shares the host’s network stack directly. Highest performance, zero port mapping needed, but no isolation. |
none | Single host | Disables all networking. The container gets only a loopback interface. Useful for batch jobs that need no network access. |
overlay | Multi-host | Spans multiple Docker daemons (Docker Swarm). Used for distributed services that need to communicate across physical machines. |
Default networks
Section titled “Default networks”Docker creates three networks automatically when the daemon starts. You can see them with docker network ls:
docker network lsExpected output:
NETWORK ID NAME DRIVER SCOPEabc123def456 bridge bridge localdef456abc789 host host localghi789jkl012 none null localThe bridge network (backed by the docker0 virtual switch) is where every container lands by default when you omit --network. The host and none networks are special-purpose.
Inspecting the default bridge
Section titled “Inspecting the default bridge”docker network inspect shows detailed configuration — subnet, gateway, and which containers are currently attached:
docker network inspect bridgeWhat this module covers
Section titled “What this module covers”| Lesson | Topic |
|---|---|
| The Default Bridge Network | How docker0 works, container IPs, and the DNS limitation |
| Container DNS and User-Defined Networks | How user-defined bridges provide automatic name resolution |
| Publishing and Exposing Ports | -p vs EXPOSE, port binding syntax, ephemeral ports |
| Custom Networks and Container Isolation | Creating, connecting, inspecting, and removing networks |
Hands-on: inspect the defaults
Section titled “Hands-on: inspect the defaults”# List all networks
docker network ls
# Inspect the default bridge in detail
docker network inspect bridge