Skip to content

Docker Networking Overview

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.

Docker ships with four built-in network drivers. Each one trades off isolation, performance, and ease of use differently.

DriverScopeDescription
bridgeSingle hostDefault driver. Creates a virtual switch (docker0) on the host. Containers on the same bridge can communicate; containers on different bridges cannot.
hostSingle hostRemoves network isolation — the container shares the host’s network stack directly. Highest performance, zero port mapping needed, but no isolation.
noneSingle hostDisables all networking. The container gets only a loopback interface. Useful for batch jobs that need no network access.
overlayMulti-hostSpans multiple Docker daemons (Docker Swarm). Used for distributed services that need to communicate across physical machines.

Docker creates three networks automatically when the daemon starts. You can see them with docker network ls:

Terminal window
docker network ls

Expected output:

NETWORK ID NAME DRIVER SCOPE
abc123def456 bridge bridge local
def456abc789 host host local
ghi789jkl012 none null local

The 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.

docker network inspect shows detailed configuration — subnet, gateway, and which containers are currently attached:

Terminal window
docker network inspect bridge
LessonTopic
The Default Bridge NetworkHow docker0 works, container IPs, and the DNS limitation
Container DNS and User-Defined NetworksHow user-defined bridges provide automatic name resolution
Publishing and Exposing Ports-p vs EXPOSE, port binding syntax, ephemeral ports
Custom Networks and Container IsolationCreating, connecting, inspecting, and removing networks
# List all networks
docker network ls

# Inspect the default bridge in detail
docker network inspect bridge
Which Docker network driver is used by default when you run a container without specifying --network?
What does the 'host' network driver do?
Which command lists all Docker networks on the current host?
Which network driver should you use when you need containers to communicate across multiple physical machines in a Docker Swarm?