Course contentsShow
← Cloud and Infrastructure
Lesson 1041 of 2,98920. Docker in DepthFree lesson

Docker Network Architecture

Understand Docker's network subsystem, CNM model, and how containers communicate with each other and external networks.

Docker Network Architecture

What you'll learn: How Docker's network subsystem works behind the scenes to connect containers to each other and the outside world.

The Big Picture

Docker's networking isn't magic—it's a carefully designed system that lets containers talk to each other and to external networks while maintaining isolation. Think of it like a sophisticated apartment building: each unit (container) has its own space, but there's infrastructure (hallways, elevators) that lets residents communicate when needed.

The Container Network Model (CNM)

Docker uses the Container Network Model (CNM), which consists of three main building blocks:

  • Sandbox: Contains a container's network stack (IP address, routing table, DNS settings). Each container gets its own sandbox for isolation.
  • Endpoint: A virtual network interface that connects a sandbox to a network. Think of it as a network cable plugged into your container.
  • Network: A group of endpoints that can communicate directly with each other. This is like a private subnet where containers can talk.

How Containers Communicate

By default, Docker creates a bridge network on your host—a virtual switch that containers plug into. Containers on the same network can find each other by name (Docker provides built-in DNS). To reach external networks or the internet, Docker uses NAT (Network Address Translation) through the host's interface.

Docker supports multiple network drivers (bridge, host, overlay, macvlan) to handle different scenarios—from simple single-host setups to complex multi-host orchestration.

Why This Matters

Understanding this architecture helps you troubleshoot connectivity issues, design secure multi-container applications, and choose the right network driver for your use case.

Key Takeaway: Docker's CNM provides a flexible, pluggable network architecture using sandboxes, endpoints, and networks to enable container communication while maintaining isolation and portability.