As of Java 9, when defining the agentlib arguments for jdwp and jvm startup you are now required to define the address= as ‘address=*:8000’ or you can’t remotely connect a debugger to a jvm running in a docker container.
If I specify
debugOptions {
enabled=true
port=8000
server=true
suspend=false
}
The JVM command line argument built is
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000
and it needs to be this instead for java9 and above
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000
When I try a simple jdb -attach from outside a docker container with the first agentlib definition I get a handshake error. When I change it to the second, the jdb -attach works fine.