I need to pass the wlan0 ip address as environment variable in Dockerfile. As this on DHCP so the IP address changes some time. I thought of running the below command to get the ip address and then use it in Dockerfile:
ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'
Above commands gives me 192.168.1.125. I want to use this ip address to pass it as environment variable. For this, I used:
RUN wlan="$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')" && echo $wlan
ENV HOST_WLAN0=$wlan
But it gave me an error Device "wlan0" does not exist.. How can I resolve this.?