4 network type:
None: No container configured to any network function, - net = none
Container: Network Namespace shared with another operation in the container, - net = Container: containerID (K8S)
the Host: Network Namespace shared with the host, - net Host =
Bridge: NAT network model Docker design
The following are explained below:
none:
[root@docker1 centos_zabbix]# docker run -it --network none centos6.9_ssh:v2 /bin/bash [root@6ae597015723 /]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever
This is not ip, you can easily play in the container, there is not much sense
container types of networks:
[@ 1c21de6080bb the root HTML] # [@ docker1 the root centos_zabbix] -a PS # Docker CONTAINER ID PORTS the STATUS the IMAGE CREATED the COMMAND NAMES 1c21de6080bb centos6.9_nginx_ssh: V3 "/ bin / the bash" Up ago Member 26 is 25 seconds The vigorous_payne seconds The [@ docker1 the root centos_zabbix ] # docker run -it --network container: 1c21de6080bb centos6.9_nginx_ssh: v4 / bin / bash share hostname ip address can view the properties [root @ docker1 centos_zabbix] # Docker PS -a CONTAINER ID PORTS the STATUS the IMAGE CREATED the COMMAND nAMES 41c457f6b89d centos6.9_nginx_ssh: V4 "/ bin / bash "5 minutes ago Up 5 minutes loving_curie 1c21de6080bb centos6.9_nginx_ssh:v3 "/bin/bash" 6 minutes ago Up 6 minutes vigorous_payne [root@docker1 centos_zabbix]# docker inspect 41c457f6b89d|grep -i network "NetworkMode": "container:1c21de6080bb8c83e800fa8b5fb15782a18bb61ab292050ca1172fbb866b1afc", "NetworkSettings": { "Networks": {}
Note that this type of public container port with a port is who, who accounted for, the later can not use this port
host type
[root@docker1 centos_zabbix]# docker run -it --network=host centos6.9_nginx_ssh:v2 /bin/bash
This is the common port and the host, who should occupy who use, but the highest performance, so we use this parameter when building the image, is to unify the type of network, improve the efficiency of building Mirror