Debugging containerized applications
Debugging is a essential tool for software developers. However, it can be a challenge in a context where there is a project based on Docker. The goal, in this post, is to provide an effective solution fro this problem.
Systems Requirements
- Intellij IDEA (it is applicable in any another IDE, as well)
- Docker Desktop 2.3.0.3
- JDK 8.0 or JDK 11.0
STEP 01: Create a Dockerfile
Create a Dockerfile at the ‘root project folder’:

STEP 02: Create a Docker-compose
Create a docker-compose.yaml file at ‘root project folder’, as well.
To fire up the docker-compose, type in the terminal(OS terminal or IDE terminal):
“docker-compose up — —build — —force-recreate
The DEBUG_OPTIONS, must be:
JDK 8:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -Xmx1G -Xms128m -XX:MaxMetaspaceSize=128m
JDK 9 or later:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -Xmx1G -Xms128m -XX:MaxMetaspaceSize=128m

STEP 03: Check the listener
In the Spring Boot log, you can verify if the Debug Listener is working at the proper port, such as below…

STEP 04: Starting debugger in your Application
This step comes up with two phases, the first one:

And…The second..

STEP 05: You are good to go!!
Lastly, with the configuration created above, start the “IntelliJ Debugger” and you can see that the debugger is now connected at the “debug port”.

In a Nutshell:
As you could see, “Debugging containerized applications” is not the “rocket science”, truly: this is super simple! And, we are here to simplify that for you! Please follow us, if you like “Complex Contents” in a easy, simple and short way. See you soon.
Github:
https://github.com/simplerdevdrops/01_debugging_containerized_applications