I have a python program which is running inside the docker container on Amazon EC2 instance.
I want to fetch the EC2 instance private IP inside my python program (which is running inside the docker container) without using http://169.254.169.254/latest/meta-data/local-ipv4 this URL.
It is easy to get the private IP of the machine using python's socket library,
like 
socker.gethostbyname(socket.gethostname())
but it doesn't give the EC2 instance's IP. Is anyone having any idea how to do it?
 
     
    