# Smaller, Faster-starting Container Images With jlink and AppCDS

DevFeed: [Smaller, Faster-starting Container Images With jlink and AppCDS](<https://devfeed.tech/articles/smaller-faster-starting-container-images-with-jlink-and-appcds-18870.md>)

Original publisher: [Read original article](<https://www.morling.dev/blog/smaller-faster-starting-container-images-with-jlink-and-appcds/>)

Published: 2020-12-13T19:30:00Z

Content type: tutorial

Language: en

Sources: [Gunnar Morling](<https://devfeed.tech/sources/gunnar-morling.md>)

Topics: [Quarkus](<https://devfeed.tech/topics/quarkus.md>), [Java](<https://devfeed.tech/topics/java.md>), [container images](<https://devfeed.tech/topics/container-images.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>), [Kubernetes](<https://devfeed.tech/topics/kubernetes.md>)

Tags: [container-images](<https://devfeed.tech/tags/container-images.md>), [containers](<https://devfeed.tech/tags/containers.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [java](<https://devfeed.tech/tags/java.md>), [jdk](<https://devfeed.tech/tags/jdk.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [linux](<https://devfeed.tech/tags/linux.md>), [quarkus](<https://devfeed.tech/tags/quarkus.md>)

## AI overview

This tutorial explains how to combine Java's jlink custom runtime images with AppCDS for a Quarkus application. It covers creating a modular runtime image, adding an AppCDS archive, building a Linux container image, and comparing image size and startup time with a full Java runtime.

## Source excerpt

Table of Contents Creating a Modular Runtime Image for a Quarkus Application Adding an AppCDS Archive to a Custom Runtime Image Creating a Linux Container Image Let's See Some Numbers! A few months ago I wrote about how you could speed up your Java application's start-up times using application class data sharing (AppCDS), based on the example of a simple Quarkus application. Since then, quite some progress has been made in this area: Quarkus 1.6 brought built-in support for AppCDS, so that now you just need to provide the -Dquarkus.package.create-appcds=true option when building your project, and you'll find an AppCDS file in the target folder. Things get more challenging though when combining AppCDS with custom Java runtime images, as produced using the jlink tool added in Java 9. Combining custom runtime images with AppCDS is very attractive, in particular when looking at the deployment of Java applications via Linux containers. Instead of putting the full Java runtime into the container image, you only add those JDK modules which your application actually requires. (Parts of) what you save in image size by doing so, can be used for adding an AppCDS archive to your container image. The result will be a container image which still is smaller than before -- and thus is faster to push to a container registry, distribute to worker nodes in a Kubernetes cluster, etc. -- and which starts up significantly faster.