Docker 如何查看容器IP地址
1.docker exec -it ID/NAMES ip addr
- root@localhost ~]# docker exec -it chemex ip addr
- 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
- 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
- 6: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
- link/ether 02:42:ac:11:00:03 brd ff:ff:ff:ff:ff:ff link-netnsid 0
- inet 172.17.0.3/16 brd 172.17.255.255 scope global eth0
- valid_lft forever preferred_lft forever
复制代码 2.查看Docker的底层信息,里面也有ip相关
docker inspect ID/NAMES
- [root@localhost ~]# docker inspect chemex
- "SandboxKey": "/var/run/docker/netns/097fea0dab2c",
- "SecondaryIPAddresses": null,
- "SecondaryIPv6Addresses": null,
- "EndpointID": "a0ccbe5d548680eefeebbe56e2466f05851a2e31665959bb83271da769b557a2",
- "Gateway": "172.17.0.1",
- "GlobalIPv6Address": "",
- "GlobalIPv6PrefixLen": 0,
- "IPAddress": "172.17.0.3",
- "IPPrefixLen": 16,
- "IPv6Gateway": "",
- "MacAddress": "02:42:ac:11:00:03",
- "Networks": {
- "bridge": {
- "IPAMConfig": null,
- "Links": null,
- "Aliases": null,
- "NetworkID": "185a64b1a5b82471a8b742294e5e2feab3f3a23e52246897decde4378af9bd47",
- "EndpointID": "a0ccbe5d548680eefeebbe56e2466f05851a2e31665959bb83271da769b557a2",
- "Gateway": "172.17.0.1",
- "IPAddress": "172.17.0.3",
- "IPPrefixLen": 16,
- "IPv6Gateway": "",
- "GlobalIPv6Address": "",
- "GlobalIPv6PrefixLen": 0,
- "MacAddress": "02:42:ac:11:00:03",
- "DriverOpts": null
- }
- }
- }
- }
- ]
复制代码 |
免责声明:
1,海欣资源网所发布的资源由网友上传和分享,不保证信息的正确性和完整性,且不对因信息的不正确或遗漏导致的任何损失或损害承担责任。
2,海欣资源网的资源来源于网友分享,仅限用于学习交流和测试研究目的,不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。
3,海欣资源网所发布的资源由网友上传和分享,版权争议与本站无关,您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。
4,如果您喜欢,请支持正版,购买正版,得到更好的正版服务,如有侵权,请联系我们删除并予以真诚的道歉,联系方式邮箱 haixinst@qq.com
|