As the title says. I need to be able to retrieve the IP address the docker hosts and the portmaps from the host to the container, and doing that inside of the container.
On Ubuntu, hostname command can be used with the following options:
hostname
-i
--ip-address
-I
--all-ip-addresses
For example:
$ hostname -i 172.17.0.2
To assign to the variable, the following one-liner can be used:
IP=$(hostname -i)