What is a default Docker network driver, and how do you change it when running the Docker image?
Docker comes with different network drivers, for instance: host
, bridge
, macvlan
and overlay
. However, bridge is always the default Docker network driver.
In other cases, you may require to make use of a Docker Swarm or even connect all your containers to the localhost network. In this case, you will need to use a different driver other than the default driver by changing the default driver into your desired network driver.
To do this, you need to create a new local network using a new network driver. First, you will have to use the –driver
or –d parameter
using the docker network create command. Afterwards, you will have to run the Docker image side by side with the local network by using the –network
command you created on the network.