Debugging containerized applications

SimplerDevDrops
2 min readJun 22, 2020

--

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…

double-check: “Listening for transport dt_socker at address: 5005”

STEP 04: Starting debugger in your Application

This step comes up with two phases, the first one:

Create a “New Configuration”, using the standard “Remote”

And…The second..

These config’s will appear automatically following the docker-compose — Super easy, not???

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

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

SimplerDevDrops
SimplerDevDrops

Written by SimplerDevDrops

Paulo Alves. Writer and software developer Dedicated to helping devs understand easily and fastly: DevOps, S.O.L.I.D Principles, TDD, Java Spring and Flutter.

No responses yet

Write a response