Open qrli opened 2 years ago
Any chance you can find out what IP address Docker's host.containers.internal
points to, versus ours? Knowing how their configuration differs would help significantly.
In podman: 172.24.126.173 host.containers.internal nameserver 172.24.112.1 // It is what WSL's $(hostname).local resolves to.
In Docker: host.docker.internal resolves to 192.168.65.2 while nameserver 192.168.65.5
I think docker is playing some magic here. It uses its own nameserver than WSL's, and the host.docker.internal
access is forwarded to Windows side without roadblock of Windows Firewall. (As it uses its own nameserver, WSL's $(hostname).local
does not work in docker. But it is OK as host.docker.internal
works for all scenarios.)
On the other hand, podman's seem to be within the WSL realm, following what's provided by WSL. In this case, I think the WSL's $(hostname).local
should work, but it does not work with ports served by podman, strangely.
I think there are 2 possible paths which podman for windows can choose from:
host.containers.internal
is equivalent to WSL's $(hostname).local
. (Of course need to address the issue of access podman exposed ports.) The benefit is that it will be consistent with WSL and inherit any new feature of WSL, while the drawback is that WSL has not yet solved the Windows Firewall issue, which treats WSL ethernet as public network, thus blocks non-standard port access from WSL by default. A friendly reminder that this issue had no activity for 30 days.
A friendly reminder that this issue had no activity for 30 days.
Some update about latest status:
Set-NetFirewallProfile -Name Public -DisabledInterfaceAliases "vEthernet (WSL)"
Some update about latest status:
* It seems "$(hostname).local" is no longer supported by WSL * nameserver IP (the 172.* IP of the Windows host for WSL) still works * There are people saying the access is no longer blocked as part of supporting WSLg - I tried but no success. Access from WSL2 to high ports of Windows side is still blocked by Windows Firewall by default. But it can be unblocked by executing `Set-NetFirewallProfile -Name Public -DisabledInterfaceAliases "vEthernet (WSL)"`
Thanks for the info.
I have a similar problem: From within the podman VM I need to access a Windows port (This is a cntlm proxy listening on :3128 on Windows). Is there any way you found to make a connection from within podman VM to Windows without having to touch firewall settings?
Pops this up a bit. There is still no change on this.
Any progress of WSL does not help either, because host.containers.internal
binds to the WSL IP, which cannot access anything on the Windows side. It is basically the same as installing Linux version of Podman inside WSL, although we expect Podman Windows to be replacement of Docker on Windows.
I think host.containers.internal
should bind to gateway IP of WSL, which is show in the first line of ip route show
. See https://learn.microsoft.com/en-us/windows/wsl/networking#mirrored-mode-networking
It may still be blocked by Windows Firewall by default when accessing ports served from Windows side, but there are already easy ways to allow it.
Terrible workaround follows.
Get a shell on the podman VM:
podman machine ssh
From this shell:
sudo yum install socat
ip route
socat TCP-LISTEN:8000,fork TCP:$ip:8000
where $ip
is the address found in ip route
(default via …
)
Is there any progress on this?
Terrible workaround follows.
Get a shell on the podman VM:
podman machine ssh
From this shell:
sudo yum install socat ip route socat TCP-LISTEN:8000,fork TCP:$ip:8000
where
$ip
is the address found inip route
(default via …
)
@randomstuff I suppose you'll have to do this for every port you want to expose? :)
I modified the .wslconfig , and added such configuration:
[wsl2]
networkingMode=mirrored
Then restarted wsl and podman machine, I found that telnet host.containers.internal 3001
was refused, but when I tried telnet 127.0.0.1 3001
, it worked.
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind feature
Description
This is about latest Podman for Windows and
host.containers.internal
. The capability ofhost.containers.internal
seems to differ from docker's. My tests have excluded the firewall factor.host.containers.internal
can access ports exposed to host in other containers. Cool.host.containers.internal
cannot access ports served by Windows applications.I'm guessing it may because
host.containers.internal
refers to the Fedora host than Windows host.On the other hand, WSL 2 has a special domain name
$(hostname).local
to access the Windows part. ($hostname refers to Windows host name rather than Linux's.)$(hostname).local
can access host Windows ports, no matter exposed by Windows or WSL. Cool.$(hostname).local
can access host Windows ports served by Windows applications. Cool.$(hostname).local
cannot access host ports served by podman.This surprise me. I cannot explain why. But at least I got a way to access Windows app ports from podman. The tricky thing is that, unlike
host.docker.internal
which I can use for all scenarios, I have to split config depending on what it is accessing to.I wish both of them work out of box. Or, at least one of them works. Thanks for the good work.
Steps to reproduce the issue:
1.
2.
3.
Describe the results you received:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):