abiosoft / abiosoft/colima

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

Aperta
#560 6 commenti 3 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
30.8k
Fork
613
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.