Docs / Containers & Docker / Understanding Docker Networking: Bridge, Host, and Overlay

Understanding Docker Networking: Bridge, Host, and Overlay

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 151 views · 2 min read

Docker Network Types

Docker provides several network drivers, each suited to different use cases. Understanding them is key to designing multi-container applications.

Bridge Network (Default)

Containers on the same bridge network can communicate by container name. This is the default for standalone containers.

# Create a custom bridge network
docker network create myapp-net

# Run containers on the same network
docker run -d --name web --network myapp-net nginx
docker run -d --name api --network myapp-net node:20

# web can reach api by name: http://api:3000

Host Network

Removes network isolation — the container shares the host network stack directly. Useful for performance-sensitive applications.

docker run -d --network host nginx
# Nginx is now accessible on host port 80 directly

Limitations: no port mapping (-p is ignored), potential port conflicts.

Overlay Network

Connects containers across multiple Docker hosts (Swarm mode). Traffic is encrypted and routed through a VXLAN tunnel.

# Initialize Swarm
docker swarm init

# Create overlay network
docker network create --driver overlay --attachable myoverlay

# Deploy services on the overlay
docker service create --name web --network myoverlay nginx

None Network

docker run --network none alpine
# Container has no external connectivity — only loopback

Inspecting Networks

docker network ls
docker network inspect myapp-net

Custom Subnet Configuration

docker network create --subnet=172.20.0.0/16 --gateway=172.20.0.1 custom-net

DNS Resolution

Custom bridge and overlay networks include an embedded DNS server. Containers resolve each other by name or network alias. The default bridge network does not provide DNS resolution — use custom networks instead.

Was this article helpful?