Hi I am running Docker Desktop and run an image in the container. I want to be able to debug the java app that is running in the container using eclipse remote debugging using port 8000. Below is my command to run the container and enable debugging:
docker container run -p 8080:8080 -v “volume:/data/” -d --name “image name” -e -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,server=y,suspend=y nexus:19999/image from nexus
Had to modify this going from Linux to Windows 10. I am able to debug in a Linux env. Needed to run docker on windows for multi environments.
When I try to remote debug inside eclipse using localhost as the host and port 8000 as the debug port I can’t seem to connect to the port, I get a connection refused. I tried using the VEthernet(WSL) IP address but that didn’t seem to work either.
Is there an option I am missing to expose all ports within the docker container that will allow me to hit the debug port.
I don’t do Java programming recently but I helped one of my colleagues to containerize a Java application. In that case the Java app was listening only on localhost and allowed connection only from localhost. We tried to change “address=PORT” (or similar parameter) to address=0:0:0:0:PORT and that solved the problem. The other solution was to use host network but in case of Docker Desktop that is not an option.
Keep in mind, even if you send a request to localhost to a forwarded port, the request goes through the Docker gateway so the container will not see you coming from localhost.