What is Docker networking?

· Category: Docker

Short answer

Docker networking provides the infrastructure for containers to communicate with each other and with external networks. Docker includes several network drivers including bridge, host, overlay, and macvlan.

How it works

By default, Docker creates a virtual bridge network called bridge on the host. Containers attached to this network receive private IP addresses and can communicate using container names if they are on a custom user-defined bridge network. Network drivers implement different topologies for different use cases.

Example

List Docker networks:

docker network ls

Inspect the default bridge:

docker network inspect bridge

Create a custom bridge network:

docker network create mynet

Why it matters

Proper container networking is essential for microservices architectures. Custom networks provide DNS-based service discovery, network isolation, and fine-grained control over which containers can communicate. Overlay networks enable multi-host networking for Docker Swarm clusters.

Key differences

  • bridge: Default isolated network on a single host.
  • host: Removes network isolation and uses the host network stack directly.
  • overlay: Enables containers on different hosts to communicate.
  • none: Disables all networking for maximum isolation.