Squeezing Java Containers: Shrinking Your Kubernetes Footprint with jlink
summary
Shows a concrete refactor path from a 523 MB Tomcat WAR to a 121 MB Alpine image using jlink custom JRE, cutting image size ~77% with zero business logic changes. Uses jdeps module list and a multi-stage Dockerfile to build a JRE of ~12 modules versus the full 49/69 module JRE/JDK, warns to rerun jdeps after dependency changes, explains Class Data Sharing tradeoffs, notes OpenTelemetry needs extra modules and Alpine musl causes JNI compatibility issues.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:53Smaller Java containers matter
- 3:37Classic lift-and-shift with Tomcat WAR
- 4:41Dropping app server with embedded Jetty
- 6:05Trimming JRE with jlink and jdeps
- 10:46Live demo of size reductions
- 12:31To-do app in action
- 14:47Performance and security trade-offs
- 16:40Size comparison and Kubernetes impact
- 18:48Spring Boot with jlink and security
- 19:54Summary
related talks
01h 01mDistilling Java Containers for Kubernetes
46mJava in a World of Containers
25mCommit to Excellence - Java in Containers
45mJVMs in Containers, Towards a Perfect Symbiosis!
55mDo not put all eggs in one container
49mJava and Containers Make it Awesome
40mJdeps, Jlink and Layers: Slim Down Your Java Docker Images
42mDownsizing. Make Your Java App Containers Ligthweight.
