Docker image - expose debug port

Hi all,

I’m trying to expose the remote debugging port from a Sonarqube Docker container.

  • The Dockerfile looks like this:
FROM sonarqube:latest
EXPOSE 8000
  • In the image properties I see afterwards that the port 8000 is exposed together with 9000
  • I than map the port 8000 in the container definition
  • and set in sonar.properties: sonar.web.javaAdditionalOpts=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 and restart
  • I can connect to the port 9000, but not on 8000 (tried with telnet and with my IDE)
  • netstat -tulpn | grep LISTEN on the host shows both ports

What am I doing wrong? Please help!

Thanks.

Hi @mirceag ,

there should be no need for you do create your own image. try something like this:

docker run -d -p 8000:8000 -p 9000:9000 sonarqube:8.5-community "-Dsonar.web.javaAdditionalOpts=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000"

after that you should be able to connect to connect to the web ui on port 9000 and to the remote debugging interface on port 8000.

jdb -attach 192.168.0.167:8000
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
>

one short hint: don’t use localhost in your connection attempt :wink:

hope that helps

1 Like

Many thanks.
The important detail that made the difference was in the address field: *:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.