How to debug when application is running in a docker environment

Alright,

Maybe this is not really a question for here, but there might be someone who is knowing how to crack this nut.

The setup

  • A scala/play framework app running in a container
  • Port 5005 enabled for debugging by using
     - JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
  • The port is available and accessible
  • The scala app is partially based on groovy based classes which allow for easy customization
  • The src files of the groovy classes are in a local folder, and that folder is mounted in the container, such that the scala app can access it.

The objective

  • I would like to be able to debug the groovy classes by setting breakpoints and inspect variables and such …
  • I would like to have autocomplete work

What combination of extensions and settings should I compose to make this work.

I tried asking Cursor, but no proposed approaches did work.