Four network types:
The following are explained separately: 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 kind of thing has no IP and can be played around in the container, which doesn't make much sense Container type network: [root@1c21de6080bb html]# [root@docker1 centos_zabbix]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1c21de6080bb centos6.9_nginx_ssh:v3 "/bin/bash" 26 seconds ago Up 25 seconds vigorous_payne [root@docker1 centos_zabbix]# docker run -it --network container:1c21de6080bb centos6.9_nginx_ssh:v4 /bin/bash The IP address that shares the host name can view the properties [root@docker1 centos_zabbix]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS 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": {} It should be noted that whoever uses a port first will occupy it, and later users will not be able to use this port. Host type [root@docker1 centos_zabbix]# docker run -it --network=host centos6.9_nginx_ssh:v2 /bin/bash This is to share the port with the host machine, whoever occupies it first will use it, but the performance is the highest, so we use this parameter when building the image, just to unify the network type and improve the efficiency of building the image The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: jQuery achieves full screen scrolling effect
>>: The perfect solution for forgetting the password in mysql8.0.19
This article example shares the specific code of ...
max_allowed_packet is a parameter in MySQL that i...
The cursor size in the input box is inconsistent T...
Table of contents 1. Rendering 2. Implementation ...
This article shares with you how to use canvas an...
Official documentation: https://nginx.org/en/linu...
Build the image Earlier we used various images fo...
Use nginx to configure the separation of PC site ...
There are 4 commonly used methods, as follows: 1....
Loading rules of require method Prioritize loadin...
An image link <img src="" /> I wa...
Application example website http://www.uhuigou.net...
Table of contents 1 Introduction to the new opera...
IFNULL(expr1,expr2) If expr1 is not NULL, IFNULL(...
Related Documents Part of this article is referen...