Akshay Vijay Jain
Akshay Vijay Jain

Reputation: 16005

what should be used instead of 'host.docker.internal' when using nerdctl in place of docker?

When using docker desktop, we would connect to the host machine from the container using the URL 'host.docker.internal'.

however container is not able to connect to the host machine (i.e my machine) when I am using nerdctl instead of docker.

I installed Rancher desktop to use nerdctl

Upvotes: 4

Views: 3729

Answers (2)

Natesh Todur
Natesh Todur

Reputation: 21

ipconfig getifaddr en0

The above command will give the IP address of your wireless connection. Note, this will only work for MacOS. This IP can then be written to the /etc/hosts of your container against host.docker.internal as they share the same network. This can help the container communicate to the host machine by using host.dock.internal . Although, an elegant solution is expected from RancherDesktop (or its already available in the newer versions).

Upvotes: 2

Midhun Krishna
Midhun Krishna

Reputation: 1759

From lima docs.

The loopback addresses of the host is 192.168.5.2 and is accessible from the guest as host.lima.internal.

So instead of host.docker.internal, provide 192.168.5.2

I have tested this with nerdctl distributed via Rancher and it works!

reference: https://github.com/lima-vm/lima/blob/master/docs/network.md

Upvotes: 2

Related Questions