Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis with wsl2 podman - connection refused

I'm running Ubuntu 20.04 within WSL2 on Windows 10.

I installed podman.

>podman -v
 podman version 3.

I tried starting a container with

podman run --name some-redis -d -p 6379:6379 redis

The container is starting. No errors in the log.

If I tried

redis-cli 

From Ubuntu it's working.

From dos/powershell it is not working

rdcli -h localhost
localhost:6379> (error) Redis connection to localhost:6379 failed - connect ECONNREFUSED 127.0.0.1:6379

And also it is not working with my SpringBoot application.

I'm also using a portainer container with port mapping 9000:9000 and I can access it from ubuntu, dos, powershell.

So what's the problem with redis. Is it coming from redis or from wsl2/podman ?

What can I do.

ps : The same container on the same machine with docker desktop was working fine.

like image 399
tweetysat Avatar asked Dec 06 '25 02:12

tweetysat


1 Answers

You probably run into this WSL2 issue: https://github.com/microsoft/WSL/issues/4851

Solution:

  • option 1: use [::1]:6379 instead of localhost:6379 from Windows side
  • option 2: use -p 127.0.0.1:6379:6379 instead of -p 6379:6379 with podman run.
like image 183
davdr Avatar answered Dec 07 '25 18:12

davdr



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!