abiosoft / abiosoft/colima

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

Đang mở
#560 6 bình luận 3 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
30.8k
Fork
613
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### 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
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.