arrow_back
Back

Docker networking: CNM, drivers, and Swarm networks

Andrew Dorokhov Andrew Dorokhov schedule 1 min read
menu_book Table of Contents

Container Network Model (CNM)

Docker networking is based on the Container Network Model (CNM) specification. CNM defines three building blocks:

  • Sandboxes — isolate the network stack (interfaces, ports, routing tables).
  • Endpoints — virtual network interfaces that connect a sandbox to a network.
  • Networks — connect endpoints together.

libnetwork is the practical CNM implementation. Drivers extend the model with different topologies.

Network drivers

  • bridge — default driver on Linux.
  • host — use the host network namespace.
  • overlay — multi-host network for distributed Docker hosts (for example in Swarm).
  • macvlan — assign a MAC address so the container looks like a physical device on the LAN.
  • none — disable networking.
  • Network plugins — third-party drivers.

Files managed inside the container

Docker always manages these files inside a container:

/etc/hosts
/etc/hostname
/etc/resolv.conf

Swarm mode

In Swarm mode, Docker creates a default ingress network with the overlay driver.

It also creates a bridge network docker_gwbridge that connects Swarm node daemons.

code

Need Help with Development?

Happy to help — reach out via the contacts or go straight to my Upwork profile.

work View Upwork Profile arrow_forward
Next Article

Docker network commands: create, connect, and inspect

arrow_forward