Need Help Accessing Docker Containers from Windows Host in WSL

Hey everyone,

I’m currently facing an issue with accessing Docker containers running in WSL2 from my Windows host.
I have installed docker inside the wsl linux via apt-get. Docker version 25.0.4, build 1a576c5
Here’s the setup:

I have a Docker container hosting an SFTP server in my WSL2 Ubuntu instance. Here’s the command I’m using to run it:

docker run \ -v ~/sftp/upload:/home/foo/upload \ -p 2222:22 -d atmoz/sftp \ foo:pass:1001

When I’m within my WSL2 Ubuntu environment, I can connect to the SFTP server using:

sftp -P 2222 foo@

However, when I attempt to connect from the Windows host via PowerShell, I encounter the following error:

ssh: connect to host port 2222: Connection timed out

Interestingly, I don’t face this issue when accessing non-Docker services running in WSL2 from the Windows host. So when I host some apache webserver in my WSL ubuntu I can reach it from windows browser via

What configurations do I need to adjust to enable accessing Docker containers from the Windows host? Any help would be greatly appreciated!