Feedback

Chat Icon

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Docker Networks
43%

Docker Networking Model

Docker networking is built on a design called the Container Network Model (CNM). This model is implemented through various "drivers" that determine how containers talk to each other and the outside world.

At its core, the model consists of three main components:

  • Sandboxes: These are the isolated network stacks inside a container (including interfaces, routing tables, and DNS settings).
  • Endpoints: These are the virtual network ports that connect a Sandbox to a Network.
  • Networks: These are the actual collections of endpoints that can communicate with one another.

Depending on your needs, Docker uses different drivers to handle the plumbing between the container and the host. These are the most common drivers:

DriverDescriptionBest Use Case
BridgeThe default driver. It creates a private internal network on the host.Standard standalone containers.
HostRemoves isolation; the container uses the host's networking directly.High-performance apps (no port mapping overhead).
OverlayConnects multiple Docker daemons (Swarm mode).Distributed microservices across different servers.
MacvlanAssigns a MAC address to a container, making it look like a physical device.Legacy apps that need to be on a physical network.

Painless Docker - 2nd Edition

A Comprehensive Guide to Mastering Docker and its Ecosystem

Enroll now to unlock all content and receive all future updates for free.

Unlock now  $31.99$25.59

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More