This mode is used by default when creating containers. The biggest problem of the host mode is that the network performance is good, but the port number already used on dockerhost cannot be used again, and the network isolation is not goodĪdvantages of host mode: it solves the problem that the IP address is not fixed 2.2 bridge modeīridge mode is the bridge mode mentioned above. The service port number inside the container can also use the port of the host without configuring NAT itself The container using host mode can directly use the IP address of the host to communicate with the external network. In this mode, only the kernel space of the container is shared, but the file system, this morning, etc. If the host mode is used when starting the container, the container name will not obtain an independent networknamespace, but share a networknamespace with the host. In this mode, the container will not virtualize its own network card, IP and other information, but use the IP and port information of the host. Detailed explanation of four common networks 2.1. The network of a container is shared by multiple containers, that is, multiple containers use the network of one containerĢ. Sealed network, without any network configuration, containers are separated from each other The container and the host share the kernel, that is, they use the same networkīridge mode is the default network mode used in docker, which is the bridge mode described above Four modes commonly used in docker network docker network mode If the container needs to be accessed by the external network, you can map the port of the container to the host, that is, when creating the container, enter - P or - P to select the exposed port number, so that the external network can access the mapped port through the host and enter the container 2, docker network mode 1. The external network cannot be addressed, which means that the external network cannot access the container through the container IP. The docker bridge is a virtual device of the host computer, not a real network device. The bridge can be created again and can be specified The docking between containers also communicates through the veth pair of the bridge. Because all containers in the same host are connected to the same bridge by default. At the same time, the docker bridge is the default gateway of each container. The offset method is called container IP. When docker starts a container, it will assign an IP address to the container according to the network segment of the docker bridge. A docker container bridge is virtualized in the host machine. docker network principleĭocker uses linux bridging.