abiosoft / abiosoft/colima

Resolve dns of `host.docker.internal` to vm's reachable IP

未关闭
#560 6 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
30.8k
派生
613
PR 合并指标
30 天内没有已合并 PR

描述

### Description

Since v0.5.0 it is possible to add `--network-address` to create an IP that is reachable from both the vm and the macOS host.
It would be great, if like at Docker Desktop on the macOS host the dns `host.docker.internal` resolves to that (reachable) IP (in my case 192.168.106.2).

#### Why?
I'd like to attach to a node debugging process that is running inside of the container, from Visual Studio Code. I already binded port 9229 to 0.0.0.0, but it's still inaccessible from the macOS host when attaching to localhost:9229. When I attach to 192.168.106.2, it just works like a charm. With docker desktop I previously used `host.docker.internal` in some of these cases.

_UPDATE: After updating to v0.5.2 and a colima stop; colims start `localhost` is also working again, but I think it's still helpful to have a resolvable `host.docker.internal` from macOS like in Docker Desktop_

#### Current behaviour
Inside the vm the dns name `host.docker.internal` is already resolved to one of the vm's IPs, but not the (new) accessible.
```sh
➜ ~ colima ssh
ping host.docker.internal
PING host.docker.internal (192.168.5.2)
64 bytes from 192.168.5.2: icmp_seq=0 ttl=64 time=0.450 ms
exit

➜ ~ ping 192.168.5.2
PING 192.168.5.2 (192.168.5.2): 56 data bytes
Request timeout for icmp_seq 0
```

#### Expected behaviour
```sh
➜ ~ colima ssh
ping host.docker.internal
PING host.docker.internal (192.168.106.2)
64 bytes from 192.168.106.2: icmp_seq=0 ttl=64 time=0.450 ms
exit

➜ ~ ping 192.168.106.2
PING 192.168.106.2 (192.168.106.2): 56 data bytes
64 bytes from 192.168.106.2: icmp_seq=0 ttl=64 time=0.450 ms
```

#### Workaround
Add the reachable IP into `/etc/hosts`
```
192.168.106.2 host.docker.internal
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。