Can I get ip address inside my docker container?

后端 未结 9 1767
南旧
南旧 2020-12-28 12:10

How to get container ip address inside this container?

\'docker inspect $hostname ...\' not suitable, because I don\'t share /var/run/docker.sock host file to contai

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-28 12:26

    I found solution to my problem:

    /sbin/ip route|awk '/scope/ { print $9 }'
    

    It's print something like: '172.17.0.135'

提交回复
热议问题