2

Since the latest (7.0.1) docker image, it's no more possible to connect a remote debug session to the JVM running within the container.

I've launched :

docker run \
  -p 9001:8080 \
  -p 9100:9100 \
  -e KEYCLOAK_USER=keycloak \
  -e KEYCLOAK_PASSWORD=password \
  jboss/keycloak:7.0.1 \
  -b 0.0.0.0 \
  --debug 9100

and then try to connect a debug session with this VSCode configuration:

{
"type": "java",
"name": "Debug (Attach) - Remote",
"request": "attach",
"hostName": "localhost",
"port": 9100
}

and got the following message:

Failed to attach to remote debuggee VM
Reason:java.net.SocketException: Connection reset

BTW, the same works fine with Keycloak with 6.0.1 and 7.0.0 docker images.

I suspect this is a side effect of the move to the new ubi8-minimal base image used since Keycloak 7.0.1

Any clue about how to solve this issue ?

Regards,

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59
Fabrice G.
  • 140
  • 1
  • 10

1 Answers1

7

The problem is Java update: 8 (Keycloak 7.0.0) vs. 11 (Keycloak 7.0.1). Java 9+ listens only on localhost by default, so could you try to listen on all interfaces (*:9100):

docker run \
  -p 9001:8080 \
  -p 9100:9100 \
  -e KEYCLOAK_USER=keycloak \
  -e KEYCLOAK_PASSWORD=password \
  jboss/keycloak:7.0.1 \
  -b 0.0.0.0 \
  --debug *:9100
Jan Garaj
  • 25,598
  • 3
  • 38
  • 59