
On Fri, Aug 21, 2020 at 10:17:00AM +0800, Luan Shengde wrote:
On Fri, Aug 21, 2020 at 09:46:17AM +0800, Wu Fengguang wrote:
As of version 18.03, you can use host.docker.internal as the host's IP.
https://stackoverflow.com/questions/22944631/how-to-get-the-ip-address-of-th...
excelent! I will try it. It seems that we need to add line in /etc/hosts: host_id host.docker.internal
which /etc/hosts? I just tried debian docker, the DNS is not available: wfg@debian ~% ping host.docker.internal ping: host.docker.internal: Name or service not known Thanks, Fengguang

On Fri, Aug 21, 2020 at 10:35:28AM +0800, Wu Fengguang wrote:
On Fri, Aug 21, 2020 at 10:17:00AM +0800, Luan Shengde wrote:
On Fri, Aug 21, 2020 at 09:46:17AM +0800, Wu Fengguang wrote:
As of version 18.03, you can use host.docker.internal as the host's IP.
https://stackoverflow.com/questions/22944631/how-to-get-the-ip-address-of-th...
excelent! I will try it. It seems that we need to add line in /etc/hosts: host_id host.docker.internal
which /etc/hosts?
I just tried debian docker, the DNS is not available:
wfg@debian ~% ping host.docker.internal ping: host.docker.internal: Name or service not known
it's the host machine: crystal-ci I test on my own server, add "host_ip host.docker.internal" in /etc/hosts, then execute "ping host.docker.internal" in docker container, it will goes well" Thanks Luan Shengde
Thanks, Fengguang

I just tried debian docker, the DNS is not available:
wfg@debian ~% ping host.docker.internal ping: host.docker.internal: Name or service not known
it's the host machine: crystal-ci I test on my own server, add "host_ip host.docker.internal" in /etc/hosts, then execute "ping host.docker.internal" in docker container, it will goes well"
Don't rely on manual configs in the host side. How about this in docker? wfg@debian ~% ip route get 1.2.3.4 1.2.3.4 via 172.17.0.1 dev eth0 src 172.17.0.61 uid 1000 cache => wfg@debian ~% ip route get 1.2.3.4 | awk '{print $3; exit}' 172.17.0.1 Thanks, Fengguang
participants (2)
-
Luan Shengde
-
Wu Fengguang