I'm aware that you can get a host's ip programatically with Python doing something like:
from socket import gethostname, gethostbyname
ip = gethostbyname(gethostname())
print(ip)
but, as expected, when running the code mentioned above from a container (just ftr, with user namespaces enabled) the output is 172.17.0.2.
How can I programmatically get the host's ip from within the container?
Note: I'm working in a Linux environment.