From 6fec8d23cad185db04fa4d3bdcdf38c1e9cec154 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Mon, 12 Aug 2024 08:26:33 +0800 Subject: [PATCH] 'commit' --- 操作文档/11、Docker常用命令.md | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/操作文档/11、Docker常用命令.md b/操作文档/11、Docker常用命令.md index 4d5f2e1..f834eb5 100644 --- a/操作文档/11、Docker常用命令.md +++ b/操作文档/11、Docker常用命令.md @@ -109,3 +109,49 @@ docker run -d --name ms-manager-sass-ui -p 80:80 -v /etc/hosts:/etc/hosts ms-m +#### 安装 $Ping$ + +```shell +apt-get update +apt-get install iputils-ping -y +``` + + + +#### 查看宿主机$IP$ + +```shell +[root@localhost ~]# ifconfig +docker0: flags=4163 mtu 1500 + inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 + inet6 fe80::42:7ff:fe80:54b1 prefixlen 64 scopeid 0x20 + ether 02:42:07:80:54:b1 txqueuelen 0 (Ethernet) + RX packets 4206426 bytes 2354824710 (2.1 GiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 3442306 bytes 746571948 (711.9 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +ens192: flags=4163 mtu 1500 + inet 10.10.14.77 netmask 255.255.255.0 broadcast 10.10.14.255 + inet6 fe80::20c:29ff:fe54:1f62 prefixlen 64 scopeid 0x20 + ether 00:0c:29:54:1f:62 txqueuelen 1000 (Ethernet) + RX packets 6180298 bytes 2946646464 (2.7 GiB) + RX errors 0 dropped 84 overruns 0 frame 0 + TX packets 4710131 bytes 2571579064 (2.3 GiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + +# 查看端口 +curl 172.17.0.1:7026 +``` + + + +#### 查看$Docker$的$IP$ + +```shell +docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' 4d2b1da162ca + +# 返回值 +172.17.0.3 +``` +