On Docker for Mac what would be the host ip as see

2019-02-05 08:51发布

This question already has an answer here:

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

标签: macos docker
1条回答
祖国的老花朵
2楼-- · 2019-02-05 09:27

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

/sbin/ip route|awk '/default/ { print $3 }'
查看更多
登录 后发表回答