Optimize the JVM Docker image size of your Spring Boot applications
Marco Grecuccio
Freelance | Senior Software Engineer, Tech Lead | Java, Python, Microservices, Web Development
Have you ever thought that the JVM Docker images of your Spring Boot applications are too fat?
Java 9 came up with a new important concept: the modularization of the JDK.
One of the main motivations here is to provide modular JVM, which can run on devices with a lot less available memory.
The use of Jdeps and Jlink, 2 tools have are shipped with the JDK, allows us to create custom minimal Java runtime environments with only the necessary modules required by your application.
Depending on the application, this can cut out massive parts of the runtime, reducing the overall Docker image size.
This can be particularly helpful when working with the Spring Boot fat jars.
I created a simple, Book Catalog application to see Jlink in action.
For more documentation:
What is your experience with Jlink and, more generally, with Java modularization?
#Java #Modularization #Jlink #Docker