Can’t connect to remote shell(iex) in Docker (WSL) Elixir container

Hello everyone,

I’m trying to set up the ElixirLS debugger to a remote node running inside a Docker container under WSL. My docker-compose.yml snippet looks like this:

ports:
  - "4000:4000"
  - "4369:4369"
  - "9500:9500"
command: >
  elixir --sname remote --cookie monster
  --erl '-kernel inet_dist_listen_min 9500'
  --erl '-kernel inet_dist_listen_max 9500'
  -S mix phx.server

Inside the container, I can connect to the remote shell with:

docker-compose exec phoenix iex --sname console --cookie monster --remsh remote

From my local machine(wsl), the app is reachable with:

curl localhost:4000

However, when I attempt this from my local machine(wsl):

iex --sname console --cookie monster --remsh remote

I get the error:

Could not connect to "remote"

I also followed this post but got the same error.
https://toranbillups.com/blog/archive/2019/04/20/attach-iex-to-running-elixir-inside-docker-container/

Has anyone successfully connected to a remote Elixir shell on a Docker container running under WSL? Any guidance on what I might be missing would be greatly appreciated!