how to debug java container
Debugging a Java container is the same as debugging a remote Java application. All you need to do is to add some arguments to the JVM, run the Java application and attach the debugger.
IDE
With your favorite IDE, create a new remote configuration:
Copy the command line arguments.
Docker container
We will use the following Docker image as an example:
If we want to add the debug argument, we can override the entrypoint:
Or if you are using docker compose:
Now, you just need to run the remote debug from the IDE, add breakpoints then use your application.
Happy debugging!