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
The Drag and Drop API adds draggable elements to ...
What we need to pay attention to is that the char...
1. Command Introduction The gzip (GNU zip) comman...
This article describes the MySQL integrity constr...
Many times when we process file uploads, such as ...
1. What problems did we encounter? In standard SQ...
It is troublesome to install the db2 database dir...
How to center your HTML button itself? This is ea...
Table of contents Preface 1. Props, $emit one-way...
This article example shares the specific code of ...
1. Use the <nobr> tag to achieve no line bre...
Table of contents Base Return Type String and Boo...
Overview This article is a script for automatical...
Preface When developing a project, I encountered ...
Preface Recently, I encountered a program using S...