DEV Community

Discussion on: Docker Tip - How to use the host's IP Address inside a Docker container on macOS, Windows, and Linux

Collapse
 
thiagorb profile image
Thiago Romão Barcala

Another alternative is to add the entry below to your Linux host's /etc/hosts:

172.17.0.1 host.docker.internal
Enter fullscreen mode Exit fullscreen mode

Then you can simple define the environments as:

  DB_UPSTREAM: http://host.docker.internal:3000
Enter fullscreen mode Exit fullscreen mode
Collapse
 
jay_67 profile image
Jay

Is 172.17.0.1 host ip?

If it is means every time host's ip address changes for some reason maybe network switching to WIFI to LAN we need to update this and rerun our compose?