Skip to content

Instantly share code, notes, and snippets.

@sheharyaar
Created November 29, 2023 09:14
Show Gist options
  • Save sheharyaar/2b26c84787aa99ff977d25157ea215cf to your computer and use it in GitHub Desktop.
Save sheharyaar/2b26c84787aa99ff977d25157ea215cf to your computer and use it in GitHub Desktop.
Docker Notes

Networking modes

Bridge mode

image image

Host mode

image

MACvLAN

image image

Disadvantages :

  • no DHCP is provided by the network (MAC Layer)
  • promiscuous mode must be enabled to allow one physical layer to have multiple MAC address (since physically only the host is connected to the router, but logically the container is also there connected to the router, so the ethernet interface should have the ability to handle packets for multiple MAC address (container and host)).

With trunk mode you can craete subinterfaces (eth0 -> eth0.0, eth0.1), etc.

IPvLAN (2)

This is at the IP layer, hence DHCP is there. Other than that similar to MACvLAN, the container still connect to the router along with the host.

IPvLAN (L3)

This is at Layer 3, here the containers don't connect to the router, instead they connect to the host as if the host is the router. This saves from broadcast packets happening due to ARP requests.

image

The issue here is that you have to create forwarding rules in the router and the host to forward the packets to the containers,since these are unaware of the networks.

image

None

No network interface for the containers :), highest isolation.

Sources

Docker Networking is CRAZY!! - NetworkChuck @ Youtube

chroot

naemspace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment