Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Docker for Mac what would be the host ip as seen from the container? [duplicate]

Tags:

docker

macos

I need to setup a debugger on my container, that requires me to set the remote (docker host) IP. In different tutorials I find different IP addresses listed as possible solution. In my container I ran a webserver that showed me that connections made to the container from my host machine come from 172.19.0.1. This is on Docker for Mac version 1.11.x.

But how would I reliably find out the host IP as seen from the container on Docker for Mac? When would it be possible for this IP to change?

Edit: Duplicate of https://stackoverflow.com/a/24716645/6309

like image 554
ddinchev Avatar asked Jul 04 '16 05:07

ddinchev


1 Answers

You can get the ip of the host from within the container by running this command:

/sbin/ip route|awk '/default/ { print $3 }'
like image 174
Kevin Simper Avatar answered Sep 20 '22 00:09

Kevin Simper