1

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 

1 Answer 1

1
docker run -it --rm -e HOST_IP=`/sbin/ip route | awk '/docker/ {print $9 }'` myimage 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.