All-Things-Docker-and-Kubernetes

Docker Networking


Container Network Model

Docker follows the Container Network Model which breaks up networking into components:

Driver

Drivers enable networking in containers. These are the available drivers in Linux:

To create a separate network:

docker network create -d driver <name> 

Network Types

Single-host Bridge Network

Single-host Host Network

Multi-host Overlay Network

Existing Network

Overlay Networks

In an overlay network, we have containers running on multiple nodes.

To create an overlay network:

$ docker network create -d  overlay <name> 

To create services for swarms:

$ docker service create --name <name>  \
    --network <name> \
    --replicas 2 \ 
    <image>

VXLAN

Overlay networks uses VXLAN. The idea is to create a layer 2 network on top of layer 3.


Back to first page