Daily Shaarli

All links of one day in a single page.

February 5, 2019

Docker Tip #65: Get Your Docker Host's IP Address from in a Container — Nick Janetakis

If you expect that IP address might change you could go the extra mile and do something like

docker container run -e "DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')"

..., this way every time you run your container, it’ll have the IP address available inside the container set to the DOCKER_HOST environment variable.