From the course: Kubernetes for Java Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Minimal Docker image using custom JRE

Minimal Docker image using custom JRE

From the course: Kubernetes for Java Developers

Start my 1-month free trial

Minimal Docker image using custom JRE

- [Instructor] We notice that our Docker image was 489 megabytes, and that is even when we use OpenJDK8-jre as the base image. Because it contains a lot of JDK functionality that is not needed by our application. JDK9 introduced module systems that allows you to selectively include the functionality needed for your application, and leave everything else behind. We'll look at how the Docker image size for our Java application can be reduced, using the tools provided by JDK9 onwards. Now jlink is a tool that we're going to use and that is available in JDK9 onwards and it allows to assemble and optimize a set of modules and their dependencies into a custom runtime image, or a custom JRE for your application. Now for that, we're going to use a setup here and let's walk through that setup a bit. What we have done is we have created an Ubuntu instance on EC2, we have logged into the instance, we have installed the default JDK. When we look at the default JDK version, that is JDK10, which is…

Contents