docker networking with multiple host interfaces

By default, Docker attaches to the eth0 interface of the host machine.

All published ports will be listening on this interface.

If an additional network interface is attached to the host machine, the containers will be inaccessible from the new interface's IP.

To mitigate this, use --net=host / network_mode: host to use the host networks.

With this, any exposed ports will be listening on all host interfaces.

last updated 2024-03-18