DEV Community

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

Collapse
 
alxgrk profile image
Alexander Girke

In case you are dealing with several Docker bridge networks, it's important to get the gateway IP of the correct network:

$ docker network inspect my-network -f "{{ (index .IPAM.Config 0).Gateway }}"
172.27.0.1
Enter fullscreen mode Exit fullscreen mode