[关闭]
@huis 2016-12-02T17:19:12.000000Z 字数 499 阅读 142

Docker使用笔记--查看Docker容器的IP

Docker


查看Docker容器的IP

  1. docker inspect containerid | grep IPAddress | cut -d '"' -f 4

比如:

  1. docker inspect 64ff8daa6626 | grep IPAddress | cut -d '"' -f 4
  2. ##结果##
  3. # 172.17.0.2
  4. # 172.17.0.2

Docker内部查看本地IP

  1. ip route show
  2. ## 结果
  3. 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.2

Docker内部查看监听端口

  1. ss -l
  2. ## 结果
  3. Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
  4. nl UNCONN 0 0 rtnl:kernel *
  5. nl UNCONN 0 0 rtnl:1689 *
  6. nl UNCONN 4352 0 tcpdiag:ss/20 *
  7. nl UNCONN 768 0 tcpdiag:kernel *
  8. nl UNCONN 0 0 6:kernel *
  9. nl UNCONN 0 0 10:kernel *
  10. tcp LISTEN 0 5 172.17.0.2:9999 *:*
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注