Hello everyone,
I’m experiencing some connectivity issues with a Docker container running on Windows Subsystem for Linux (WSL) and would appreciate any insights or solutions.
Problem Description
I have a Docker container named tys24 that is running a Java application, which is configured to listen on port 7090. The setup is as follows:
- The container can be accessed via localhost:7090 from within WSL and from the container’s IP address (172.22.0.2) without issues.
- However, when I try to access the same application from the Windows host using 192.168.0.180:7090, I receive a “Connection refused” error.
Network Configuration
Here are some key points regarding my network setup:
- The container is connected to a custom Docker network, which is configured with the subnet 172.22.0.0/16.
- The output of docker port tys24 shows that port 7090 is mapped to 0.0.0.0:7090 and [::]:7090, indicating it should be accessible externally.
- I have tried adding a port proxy using netsh to forward traffic from 192.168.0.180:7090 to localhost:7090, but it hasn’t resolved the issue.
Commands and Outputs
- Docker Network Inspection:
Run the command docker network inspect custom_network. - Port Proxy Configuration:
Run the command netsh interface portproxy show all. - Container Listening Ports:
Inside the container, run the command docker exec -it tys24 netstat -tuln.
The output shows that the application is listening on ::7090 (IPv6), but not explicitly on the IPv4 address.
Steps Taken
- Verified that the Java application listens on all interfaces by setting server.address=0.0.0.0.
- Checked Windows Firewall settings and ensured the necessary ports are allowed.
- Restarted WSL and Docker multiple times.
- Attempted to create a new Docker network to see if that would resolve the issue.
Questions
- Has anyone encountered a similar issue with Docker on WSL?
- Are there any specific configurations that I might be missing to allow external access to the container?
- Would using a reverse proxy or different networking configurations help in this situation?
Thank you for your help!