简体   繁体   English

Rancher Desktop dockerd 替代 host.docker.internal

[英]Rancher Desktop dockerd alternative for host.docker.internal

I am using Rancher Desktop with dockerd(moby)我正在使用带有 dockerd(moby) 的 Rancher Desktop

When I use docker desktop, I can connect to the host machine from the container using host.docker.internal当我使用 docker 桌面时,我可以使用host.docker.internal从容器连接到主机

But while using Rancher Desktop, host.docker.internal is not pointing to the localhost(I'm trying to connect to postgres database on my localhost).但是在使用 Rancher Desktop 时, host.docker.internal没有指向本地主机(我正在尝试连接到本地主机上的 postgres 数据库)。 I have also tried -.network=host but I'm not able to curl to http://127.0.0.1:8080 , provided I had a frontend running on 8080.我也尝试过-.network=host但我无法从 curl 到http://127.0.0.1:8080 ,前提是我有一个在 8080 上运行的前端。

What should be the alternative host.docker.internal for Rancher Desktop with dockerd(moby)?带有 dockerd(moby) 的 Rancher Desktop 的替代host.docker.internal应该是什么?

I have tried quite a few answers but none has helped me.我尝试了很多答案,但没有一个对我有帮助。 I know this question has been asked but any help would be really appreciative.我知道有人问过这个问题,但我们将不胜感激。

On Windows, you may need to create a firewall rule to allow communication between the host and the container.在 Windows 上,您可能需要创建防火墙规则以允许主机和容器之间的通信。 You can run below command in a privileged powershell to create the firewall rule.您可以在特权 powershell 中运行以下命令来创建防火墙规则。

New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action All

Pls refer here请参考这里

https://docs.rancherdesktop.io/faq/#q-can-containers-reach-back-to-host-services-via-hostdockerinternal https://docs.rancherdesktop.io/faq/#q-can-containers-reach-back-to-host-services-via-hostdockerinternal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM