Can I get ip address inside my docker container?

后端 未结 9 1773
南旧
南旧 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:22

    FROM alpine
    
    # Upgrade grep so that it supports -Po flags
    RUN apk add --no-cache --upgrade grep
    
    ENV IPADDRESS "ip a show eth0 | grep -Po 'inet \K[\d.]+'"
    

提交回复
热议问题