Docker offers multiple network drivers, each suited for different use cases.
Create a new bridge network:
docker network create my-bridge-network
Run a container using the host network:
docker run --network host my-image
Create an overlay network:
docker network create -d overlay my-overlay-network
* Assigns a MAC address to each container, making it appear as a physical device on the network. * Containers can be directly connected to the physical network. * Useful for legacy applications requiring direct network access.
Create a macvlan network:
docker network create -d macvlan \ --subnet=192.168.1.0/24 \ --gateway=192.168.1.1 \ -o parent=eth0 my-macvlan-network