Docker 获取宿主机 IP 地址 作者: Chuwen 时间: 2021-09-12 分类: Docker 网上查找,都没有找到相关的 这个域名得到的就是宿主机的 IP:`host.docker.internal` 所以怎么使用应该知道了吧 ``` [root@3905274ca2a3 /]# ping host.docker.internal PING host.docker.internal (192.168.65.2) 56(84) bytes of data. 64 bytes from 192.168.65.2 (192.168.65.2): icmp_seq=1 ttl=37 time=0.173 ms 64 bytes from 192.168.65.2 (192.168.65.2): icmp_seq=2 ttl=37 time=0.524 ms 64 bytes from 192.168.65.2 (192.168.65.2): icmp_seq=3 ttl=37 time=0.248 ms 64 bytes from 192.168.65.2 (192.168.65.2): icmp_seq=4 ttl=37 time=0.515 ms ^C --- host.docker.internal ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3039ms rtt min/avg/max/mdev = 0.173/0.365/0.524/0.156 ms ``` 标签: Docker