Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker network setting "--net=host" does not work with 1.15.x using windows and wsl #7378

Open
benzman81 opened this issue Aug 26, 2024 · 5 comments · May be fixed by #7746
Open

Docker network setting "--net=host" does not work with 1.15.x using windows and wsl #7378

benzman81 opened this issue Aug 26, 2024 · 5 comments · May be fixed by #7746
Assignees
Labels
area/networking area/wsl WSL integration kind/enhancement New feature or request parity/project Feature is available from other projects platform/windows regression Functionality was working in a previous release and is now broken
Milestone

Comments

@benzman81
Copy link

Actual Behavior

Starting a docker container in wsl with network setting "--net=host" does not work anymore as host servers are not available in container and container services not in wsl.

Steps to Reproduce

  1. start some server in wsl (i used npm install -g http-server and started it with http-server -p 8686)
  2. Start a docker container with network setting "--net=host"
  3. Try "wget http://localhost:8686" in container.
  4. Result ist Connection refused

The other way around:

  1. Start a docker container with network setting "--net=host"
  2. start some server in container (i used npm install -g http-server and started it with http-server -p 8787)
  3. Try "wget http://localhost:8787" in wsl.
  4. Result ist Connection refused

Result

Result ist Connection refused wheren accessing both servers.

Expected Behavior

Both services are reachable.

Additional Information

Downgrading back to 1.14.2 also did not work until I disabled "Networking Tunnel". Then it starts working again.

Maybe its related to #7294 as the address 192.168.1.1 is already pingable within my company network even without starting rancher.

For now we seem to be stuck on 1.14.2 with disabled network tunnel.

Rancher Desktop Version

1.15.x

Rancher Desktop K8s Version

1.30.4

Which container engine are you using?

moby (docker cli)

What operating system are you using?

Windows

Operating System / Build Version

Microsoft Windows 10 Enterprise 10.0.19045 Build 19045

What CPU architecture are you using?

x64

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

None

Windows User Only

Yes, we use Pulse Secure VPN.

@benzman81 benzman81 added the kind/bug Something isn't working label Aug 26, 2024
@rancher-sandbox rancher-sandbox deleted a comment Aug 26, 2024
@Nino-K
Copy link
Member

Nino-K commented Sep 23, 2024

@benzman81 I managed to reproduce this in the version you mentioned, however, I also tested this in our previous versions 1.11.1 (of course not using Network Tunnel), and it still did not work. It looks as though we have never supported the host network driver mode. However, after reading the documents closely, if you use -p to publish your ports, you will probably achieve what you are trying to do on Rancher Desktop. Once you use the published port flag, you can use one of the following domains to access your port on the host from the container.

host.docker.internal

or

host.rancher-desktop.internal

Can I ask you what is your use case? so, I can help you better.

@Nino-K Nino-K removed the kind/bug Something isn't working label Sep 23, 2024
@benzman81
Copy link
Author

@Nino-K hi, we use vscode with RancherDesktop, WSL and Devcontainer. Until 1.15.x all ports from WSL have been available in the devcontainer and all servers started in devcontainer were available outside the devcontainer in WSL( my collegues are using 1.13.x to 1.14.x I think, some may use older versions but without devcontainer). Since ports on both side are not fixed as it differs per developer and use case, we used host network for starting the devcontainer. Now v1.15. stops us from upgrading. Hope that helps.

@Nino-K
Copy link
Member

Nino-K commented Sep 24, 2024

I think I understand a bit better, can you guys avoid using --net=host argument and use -p (published ports) instead?

@benzman81
Copy link
Author

As I stated, since ports are not fixed I do not know how to solve this. It is not defined which server and how many a developer starts in wsl oder in the devcontainer.

@jandubois jandubois added the kind/enhancement New feature or request label Oct 19, 2024
@gi-dorio
Copy link

We are experiencing the same issue. I am working with an older Rancher Desktop version (1.10.0) and the network mode "host" seems to work fine. A colleague, who's working with Rancher Desktop 1.15.1, is not able to see anything published with network mode "host". While port mapping is still an option, the network mode "host" helps with reducing clutter in our docker-compose file, so it would be nice to be able to use it

@jandubois jandubois added regression Functionality was working in a previous release and is now broken parity/project Feature is available from other projects labels Oct 31, 2024
@gunamata gunamata added this to the 1.17 milestone Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking area/wsl WSL integration kind/enhancement New feature or request parity/project Feature is available from other projects platform/windows regression Functionality was working in a previous release and is now broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants
@jandubois @Nino-K @benzman81 @gunamata @gi-dorio and others