rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.96k stars 281 forks source link

Containers started by nerdctl are not accessible on Windows side; dockerd engine containers work fine. #6320

Open Anutrix opened 9 months ago

Anutrix commented 9 months ago

Actual Behavior

Containers started by nerdctl are not accessible on Windows side.

If the engine is dockerd(moby), A webserver started on Windows Rancher Desktop can be accessed on WSL2 browsers and Windows browsers. But if the engine is nerdctl, a webserver started on Windows Rancher Desktop can be accessed on WSL2 browsers only and NOT Windows browsers.

Not sure if this nerdctl or Rancher Desktop issue.

Steps to Reproduce

  1. Start a webserver container on localhost on any port: nerdctl compose -f docker-compose.yaml up on Windows PowerShell. Note: nerdctl compose already has a WSL path issue and is an different unrelated bug: https://github.com/rancher-sandbox/rancher-desktop/issues/4364.
  2. Visit it on localhost on a browser like Firefox on Windows.

Result

The server will just timeout and fail when accessed on Firefox on Windows. Normally accessible if curled or accessed from inside WSL.

Expected Behavior

The server should be accessible both on WSL side and Windows side like it does with dockerd(moby).

Additional Information

No errors seen in the logs.

Rancher Desktop Version

1.11.1

Rancher Desktop K8s Version

NA - Not enabled

Which container engine are you using?

containerd (nerdctl)

What operating system are you using?

Windows

Operating System / Build Version

Windows 11 Pro Version 23H2

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No VPN, Proxy, Special Firewall rules, Security Software or custom Activity directory features.

gunamata commented 9 months ago

@Anutrix , This issue could be duplicate of #6320 especially if you have switched the container engine and tried running compose file or a container. Can you please try one of below approaches and let us know if nerdctl compose works?

If you want to continue using the default network:

Switch to the Networking Tunnel:

As indicated in the issue #6320, enabling the Networking Tunnel tunnel doesn't give this problem. So I strongly recommend you switching to the Networking Tunnel. Heads up: There's a plan to make the Networking Tunnel default in one of the upcoming Rancher Desktop releases.

Anutrix commented 9 months ago

@gunamata I think you self tagged the issue number by mistake.

jandubois commented 9 months ago

I think @gunamata meant to specify #5891 instead.

gunamata commented 9 months ago

yes @Anutrix, I self tagged this issue by mistake. As Jan pointed above, #5891 is the issue I meant.

Did you get a chance to try the suggested steps?

Anutrix commented 9 months ago

@gunamata

@Anutrix , This issue could be duplicate of #6320 especially if you have switched the container engine and tried running compose file or a container. Can you please try one of below approaches and let us know if nerdctl compose works?

If you want to continue using the default network:

* Exit Rancher Desktop

* Run `wsl --shutdown` from a terminal

* Start Rancher Desktop and try running the `nerdctl compose` again

Tried above steps. It didn't work. Same behavior as before:

Switch to the Networking Tunnel:

As indicated in the issue #6320, enabling the Networking Tunnel tunnel doesn't give this problem. So I strongly recommend you switching to the Networking Tunnel. Heads up: There's a plan to make the Networking Tunnel default in one of the upcoming Rancher Desktop releases.

~This worked. I am fine with this if it's gonna be default in the future.~ ~Should I close this ticket or keep it open for above issue?~

This method worked except it fixed it on Windows side but Firefox in WSL can't access it now at localhost. However, it is accessible at http://172.22.224.1:8080 on both sides. That IP is from /etc/resolv.conf.

Feels like a WSL networking issue now and https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking might fix this issue or might be causing it.

I will keep Networking Tunnel on regardless.