Docker内部里面,ipconfig/ip 等命令是无法使用的,正确的命令是
$ hostname -I
172.24.116.11
假设你已经有了一个Docker,ID是f864187a2406
$ docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' f864187a2406
172.24.116.11
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' f864187a2406
172.24.116.11
$ docker inspect f864187a2406 | egrep -e "(IPAddress|Id)"
"Id": "f864187a24065636dc0cf9e87bdf2971fea27d4014cf981eaac6b971506b2776",
"deployId": "8747",
"SecondaryIPAddresses": null,
"IPAddress": "172.24.116.11",
"IPAddress": "172.24.116.11",
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有