Exploring OpenJDK 17 Images: A Comprehensive guide

Java 17 is soon becoming the minimal JDK version for top frameworks such Spring Boot. Selecting the right OpenJDK 17 image for your projects is crucial. This tutorial aims to introduce and test various OpenJDK 17 images available, providing insights into their features and performance.

Introduction

OpenJDK offers multiple distributions and variants, each catering to different use cases, optimizations, and sizes. Testing these images can help identify the best fit for your applications.

Firstly we will mention that the pre-release OpenJDK image are now deprecated! Therefore, you are advised not to use any openjdk:17- images. In this article, we will go through most common alternatives.

Eclipse Temurin JDK 17

Eclipse Temurin, formerly known as AdoptOpenJDK, is a community-driven open-source implementation of the Java Platform Standard Edition (Java SE). It is a highly performant, secure, and production-ready alternative to Oracle’s commercial JDK offerings. Eclipse Temurin is developed and maintained by a team of experts from organizations like Google, Red Hat, SAP, IBM, and others.

How to pull it the latest version of it:

docker pull eclipse-temurin:17-jdk

And here is the Image size:

eclipse-temurin                              17-jdk      b97bd7dd6cbd   About an hour ago    407MB

Please note that there’s a large list of other images and tags available for the eclipse-temurin project. You can check them here .

Amazon Corretto JDK 17

Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK) maintained and provided by Amazon. It’s essentially a distribution of OpenJDK with long-term support that aims to provide a secure, stable, and free version of Java for developers and enterprises.

How to pull it:

docker pull amazoncorretto:17

Here is the Amazon Corretto Image Size:

amazoncorretto    17         7bcdd1052911   15 hours ago     464MB

Finally, the list of JDK 17 Tags for amazoncorretto Image is available here.

Red Hat Build of OpenJDK 17

Red Hat build of OpenJDK is a build of the Open Java Development Kit (OpenJDK) with long-term support and patches from Red Hat. It is distributed as part of Red Hat Enterprise Linux, but is also available with OpenShift and Red Hat Middleware. It is available on Linux, Windows, macOS, and as container images.

Here is how to pull Red Hat’s OpenJDK:

docker pull registry.access.redhat.com/ubi8/openjdk-17

Then, here is the Image size of Red Hat Build of JDK:

registry.access.redhat.com/ubi8/openjdk-17   latest     f5b3ec58f205   4 weeks ago    442MB

Comparing JDK 17 Support and EOL

Before you use in production any product, such as the JDK, it is essential to know more about the Support Policy and the End of Life terms of it. The following table summarizes the differences between the above JDK:

JDK DistributionSupport PolicyEOL Date
Eclipse Temurin JDK 17Community-based support. Paid support by partners.At least Oct 2027
Amazon Corretto JDK 17If you already have an AWS Support Plan, Corretto is covered on the same basis as all other supported AWS Services and software.October 2029
Red Hat OpenJDK 17Red Hat’s support requires a Red Hat subscription.October 2027

Testing the JDK Images

Finally, here is a simple Dockerfile you can use to build a Container Image that runs a Java file using one of the above images:

FROM amazoncorretto:17

RUN echo 'public class HelloWorld {  \
    public static void main(String[] args) {  \
        System.out.println("Hello, World!");  \
    } \
}' > HelloWorld.java

# Alternatively, copy the file from the current directory
# COPY HelloWorld.java .

RUN javac HelloWorld.java

CMD java HelloWorld

Build the Container image first:

docker build -t hellojava .

Then, run it with docker run as follows:

openjdk 17 docker images

Summary

In this comprehensive guide, we’ve explored the landscape of OpenJDK 17 images, crucial for modern Java development. Beginning with the rising significance of Java 17 in frameworks like Spring Boot, we delved into key distributions including Eclipse Temurin, Amazon Corretto, and Red Hat’s OpenJDK.

Each distribution brings its unique strengths, from Eclipse Temurin’s community-driven approach, Amazon Corretto’s long-term support, to Red Hat’s focus on enterprise-grade stability. Understanding these differences aids in selecting the ideal image tailored to specific project needs.