The meaning of docker network mode: 1. Bridge mode, the default network driver model, will automatically configure its own network information when the docker container is started; 2. Host mode, breaking the relationship between the Docker container and the host Network isolation between the two, directly using the network environment of the host machine; 3. Overlay mode, which can connect multiple docker daemons or meet the communication between cluster services; 4. none mode, which disables the network driver; 5. plugins mode, uses Third-party network driver plug-in.
The operating environment of this tutorial: linux7.3 system, docker version 19.03, Dell G3 computer.
There are 5 common network modes in docker, which are
bridge : The default network driver model in Docker. If not specified when starting the container, it will default to this driver type;
host: Break the network isolation between the Docker container and the host, directly Using the host's network environment, this model is only applicable to Docker 17.6 and above;
overlay: can connect multiple docker daemons or satisfy communication between cluster services; applicable Communication between docker containers on different hosts;
none: The network driver is disabled and you need to manually customize the network driver configuration;
plugins: Use third-party network driver plug-ins;
Characteristics and application scenarios of various modes
bridge mode
To put it simply: wearing a vest, doing your own thing under the banner of the host. Docker's default mode will automatically configure its own network information when the docker container is started. All containers on the same host are on the same network and can communicate with each other. Similar to the nat mode of our vmware virtual machine. Using the host's network card for communication will cause resource consumption and low network efficiency because network conversion is involved.
host mode
To put it simply, it means occupying the magpie's nest and using the host's things to do your own things. Containers use the host's IP address to communicate.
Features: Containers and hosts share the network
container mode
Newly created containers use the created container network, similar to a LAN
Features: Shared network between containers
none mode
This mode is the purest and will not help you with any network configuration. Maximum customization.
overlay mode
Containers are no longer on the same network and can communicate with each other.
Recommended learning: "docker video tutorial"
The above is the detailed content of What does network mode in docker mean?. For more information, please follow other related articles on the PHP Chinese website!