Docker Community Forums

Share and learn in the Docker community.

How to access host IP from inside of the docker container?

Expected behavior

Wanted to get the host IP(which is my EC2 instance) from inside of the docker container. I am running a python program inside the container of docker where am using socket library to get the private IP of the machine which ends up picking up the docker container’s IP which I don’t want. What I want is the EC2 instance’s IP but without using curl

Actual behavior

Want to get the host IP

Additional Information

Is there any way I can do that ?

Are you find docker ip?
If yes then Use docker inspect
Then You got a docker ip