Reputation: 24457
I want to run a container and pass it the host IP (which will be visible by the container) as an environment variable to my container, how can I do that ?
Here is what it should like:
docker run -it --rm -e HOST_IP=`script which will give me the host IP visible by the future running container` myimage
Upvotes: 1
Views: 80
Reputation: 24457
docker run -it --rm -e HOST_IP=`/sbin/ip route | awk '/docker/ {print $9 }'` myimage
Upvotes: 1