You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Containers rarely run in isolation — they need to communicate with each other, with the host, and with the outside world. This lesson covers Docker's networking model, network drivers, port mapping, DNS resolution, and network isolation strategies.
Docker provides several built-in network drivers, each suited to different use cases.
| Driver | Description | Use Case |
|---|---|---|
bridge | Default; isolated network with NAT to host | Single-host container comms |
host | Container shares the host's network namespace | Maximum network performance |
none | No networking at all | Maximum isolation |
overlay | Multi-host networking (Swarm/Kubernetes) | Cross-host container comms |
macvlan | Assigns a MAC address; container appears on physical LAN | Legacy apps needing direct LAN |
When you start a container without specifying a network, Docker connects it to the default bridge network.
# Run two containers on the default bridge
docker run -d --name web nginx:alpine
docker run -d --name api node:20-alpine sleep 3600
# Inspect the default bridge network
docker network inspect bridge
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.