2. Reduce the container image footprint ◦ Alternative base images ◦ Jigsaw and native JRE 3. Setting memory limits ◦ Out of the box default is wrong ◦ Using cgroups and new JVM features ◦ JVM ergonomics
• The Docker image size is 726 MB • Is it something weird? Why should I care about it? • Larger image - slower deployment • More unused stuff - more room for exploits • Technical excellence [ Demo ]
hundred megs 2. Jigsaw and modularization allows to make it even smaller, but a. You have to use Java9+ b. You have to build the native JRE inside Docker c. It’s more complex and therefore more fragile
Docker! 2. Use cgroups-provided value instead of environment variable 3. The default ergonomics is not good for Docker a. Either compute the memory limit yourself b. Or use -XX:MaxRAMPercentage=N for Java10+
Java HTTP server in 35MB Docker image • Java inside Docker: What you must know to not FAIL Email: [email protected] GitHub: https://github.com/alterrebe