While Java 17 from IBM (Semeru Runtime with OpenJ9) is not GA’d yet, this doesn’t mean you cannot create an image yourself with the milestone builds. This is how it is done.
Table of Contents
Short version on Twitter
I shared a short version on how to do this on twitter. If this is all you need, go ahead and build the image right now! If you would like to see a quick tutorial, just read on.
Step 1: Cloning the repositories
First step will be cloning the repositories mentioned in the tweet like so:
bmarwell@wells ~/git/ibm $ git clone https://github.com/ibmruntimes/semeru-containers.git Cloning into 'semeru-containers'... remote: Enumerating objects: 695, done. remote: Counting objects: 100% (695/695), done. remote: Compressing objects: 100% (406/406), done. remote: Total 695 (delta 303), reused 580 (delta 244), pack-reused 0 Receiving objects: 100% (695/695), 126.35 KiB | 4.68 MiB/s, done. Resolving deltas: 100% (303/303), done. bmarwell@wells ~/git/ibm $ git clone https://github.com/OpenLiberty/ci.docker.git Cloning into 'ci.docker'... remote: Enumerating objects: 5845, done. remote: Counting objects: 100% (439/439), done. remote: Compressing objects: 100% (197/197), done. remote: Total 5845 (delta 299), reused 346 (delta 241), pack-reused 5406 Receiving objects: 100% (5845/5845), 39.82 MiB | 17.25 MiB/s, done. Resolving deltas: 100% (2602/2602), done.
Step 2: Make a Java 17 image for Semeru with OpenJ9
This is mostly copy and pasting. There is a Java 16 image. Just copy it to Java 17, exchange the URLs and checksums and build and tag it:
bmarwell@wells ~/git/ibm/semeru-containers $ cd semeru-containers bmarwell@wells ~/git/ibm/semeru-containers $ cp -r 16 17 # the next command will insert the sha256sum and download link into the Docker build file. # Also note that the eisting sha256sum could have changed. bmarwell@wells ~/git/ibm/semeru-containers $ sed -i.bak -e 's#ENV JAVA_V.*#ENV JAVA_VERSION jdk-17.0.1+12_openj9-0.29.1-m1#g' -e 's#https.*jdk-16.*x64_linux.*\.tar\.gz#https://github.com/ibmruntimes/semeru17-binaries/releases/download/jdk-17.0.1%2B12_openj9-0.29.1-m1/ibm-semeru-open-jdk_x64_linux_17.0.1_12_openj9-0.29.1-m1.tar.gz#g' -e 's#13.*886e#78e215d960a38883cce442f36fb3b30d2b5b98ea2f33698649cf42f5f67b8651#g' 17/jdk/ubi/Dockerfile.open.releases.full # Tag the image bmarwell@wells ~/git/ibm/semeru-containers $ ./build.sh ibmsemeruruntimes:open-17-jdk-ubi $PWD/17/jdk/ubi/ bmarwell@wells ~/git/ibm/semeru-containers $ docker image ls -a | grep semeru ibmsemeruruntimes open-17-jdk-ubi df1c05d273c7 27 seconds ago 857MB
Tip for corporate environments
If you are building this image behind a corporate proxy and you already have your local UBI repository mirror, create a directory called
17/jdk/ubi/root and create the file
etc/yum.repos.d/ubi.repo. Configure your repos there and add the directive
COPY ./root / just before the first yum/dnf execution. Don’t forget to add certificates to
etc/pki/ca-trust/source/anchors if needed.
You might also want the referenced tomcat and IBM Semeru Runtime locally to avoid proxy authentication problems.
Step 3: Make an OpenLiberty Image based on the new Semeru image
Now that we have a Java 17 image, we can create an OpenLiberty image. Please note that the OpenLiberty repository only uses LTS releases, so we have to use 11 as a base for now.
Also note all non-kernel images are based on the kernel image, so we need to build that one first.
bmarwell@wells ~/git/ibm/ci.docker $ cp releases/220.127.116.11/kernel-slim/Dockerfile.ubi.openjdk11 releases/18.104.22.168/kernel-slim/Dockerfile.ubi.openjdk17 # Switch to our new JDK17: sed -i.bak -e 's#FROM ibmsemeruruntime/open-11-jdk:ubi-jdk#FROM ibmsemeruruntimes:open-17-jdk-ubi#g' releases/22.214.171.124/kernel-slim/Dockerfile.ubi.openjdk17 # build and tag bmarwell@wells ~/git/ibm/ci.docker $ ./build/build.sh --dir=releases/126.96.36.199/kernel-slim/ --dockerfile=Dockerfile.ubi.openjdk17 --tag=open-liberty:188.8.131.52-kernel-slim-java17-openj9 bmarwell@wells ~/git/ibm/ci.docker $ docker image ls | grep "open-liberty.*java17" open-liberty 184.108.40.206-kernel-slim-java17-openj9 11012c16e71f 36 seconds ago 946MB
Step 4: Use the image
You’re done! Use the image as you would normally:
This should lead to a output similar to this (from the JSON logs):