Can I get ip address inside my docker container?

后端 未结 9 1771
南旧
南旧 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条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 12:31

    Why not something as simple as:

    grep "`hostname`" /etc/hosts|awk '{print $1}'
    

    or

    grep "$HOSTNAME" /etc/hosts|awk '{print $1}'
    

提交回复
热议问题