Can only access containers using localhost from the host

This claim is not correct. I tested it with Default networking mode “Dual IPv4/IPv6” with Docker Desktop 4.50.0 and a container created like this:

docker run -it --rm -p 80:80 traefik/whoami:latest

I checked in Powershell whether the port listens on the Windows host:

PS C:\Users\metin>  netstat -ano | findstr ':80 '
  TCP    0.0.0.0:80             0.0.0.0:0              ABHÖREN         6932
  TCP    [::]:80                [::]:0                 ABHÖREN         6932
  TCP    [::1]:80               [::]:0                 ABHÖREN         32312

Then I used curl to test in the Powershell terminal on the Windows host:

curl -4 localhost
curl -6 localhost
curl <host ipv4>
curl <host ipv6 ULA>
curl <host ipv6 GA>

The first three get a response, the last two time out.
Then I tried curl <host ipv4> from a remote host: it works as well.

Update: if Default networking mode “ipv4 only” is used, all 5 curl commands work from the Windows host. But from a remote host still only the host ipv4 address works.

Note: the tests are done with wsl2 networkmode=nat (=the default mode)

Update2: with wsl2 networkmode=mirrored it behaves the same.