Hi Grzegorz Jurek,
It seems the issue you're experiencing is related to how Docker or the Dev Containers environment is mapping ports to localhost, causing the "connection refused" error. Since you've mentioned that accessing the service via your local IP address works, this indicates that the issue likely lies with the port mapping for localhost. Here are a few suggestions that may help:
1.Continue using your local IP address: As you've discovered, using the local IP (<local-ip>:32001) resolves the issue. This suggests that the port mapping to localhost is not functioning correctly. Using the IP address directly is a valid workaround and should work for testing purposes.
2.Check Docker network settings: In some cases, Docker might not expose ports correctly to localhost. If you're on Linux, you can try running Docker with the --network host option, but this isn't supported on Windows. For your case, continuing to use the local IP address seems to be the best option.
3.Review Windows Firewall or Docker configuration: Since you are using Windows, ensure that Docker Desktop is properly configured to expose ports and that your firewall settings allow Docker to map ports as needed. It might be necessary to adjust your firewall settings to allow Docker traffic through specific ports.
4.Verify port availability: You can use the netstat -an command or a tool like nmap to check if port 32001 is open and listening on localhost. If the port isn’t listed, this could explain why the connection is being refused.
Since using the local IP address works for you, I would suggest continuing with that method for now. If you wish to fully resolve the localhost issue, reviewing your Docker network configuration could provide additional insights.
Let me know if you need further assistance
If you have found the answer provided to be helpful, please click on the "Accept answer/Upvote" button so that it is useful for other members in the Microsoft Q&A community.
Thank you.