marcel f
marcel f

Reputation: 298

Can connect to rootless podman container with localhost but not with 127.0.0.1

I am developing in Windows 11 and was running Docker Desktop (development in remote containers with VSCode) and I am now evaluating a switch to podman (have done a clean install of new WSL2 Ubuntu 22.04, the installed podman and docker-compose), but I cannot solve an issue that seems to be related to networking / WSL2 networking.

I can access my podman containers (from windows) with localhost, but not with 127.0.0.1.

In my full setup, I am running an nginx container as a reverse proxy for my front-end and my back-end containers. I have created a fake domain in my hosts file (mapped to 127.0.0.1) and have issued a certificate so that I can connect to my web app with https://app.mylocaldomaindev.com.

I can replicate the problem with one single container, for example:

podman run --name nginx -P -d nginx

I then check the ports assigned: 0.0.0.0:32939->80/tcp

I then try to connect from the windows host: I can connect with "curl http://localhost:32939", but not with "curl http://127.0.0.1:32939". If I run the command above on my machine with docker destop (so "docker run --name nginx -P -d nginx"), I can connect from a windows shell to "localhost" and "127.0.0.1". What do I need to change on my podman / wsl2 config so that I can connect with 127.0.0.1 to my podman container (and use my fake domain) ?

Upvotes: 0

Views: 66

Answers (0)

Related Questions