Java J9 in Containers
IBM and Semeru Java in Containers
Recipe
- In general, tune
-XX:MaxRAMPercentage
and-XX:InitialRAMPercentage
instead of-Xmx
and-Xms
, respectively, to allow for more flexibility with sizing of containers at the host level. Default values depend on any container memory limit. - Consider using
-XX:+ClassRelationshipVerifier
to improve start-up time. - If using Semeru Java >= 11 and memory in the pod is limited, consider using the remote JITServer on available platforms to avoid potential throughput issues.
Container Images
- IBM Container Registry:
- IBM Semeru Runtimes Java 8 Open Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:open-8-jre-ubi
orFROM icr.io/appcafe/ibm-semeru-runtimes:open-8-jdk-ubi
- IBM Semeru Runtimes Java 8 Open Edition on Ubuntu:
FROM icr.io/appcafe/ibm-semeru-runtimes:open-8-jre-focal
orFROM icr.io/appcafe/ibm-semeru-runtimes:open-8-jdk-focal
- IBM Semeru Runtimes Java 11 Certified Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:certified-11-jre-ubi
orFROM icr.io/appcafe/ibm-semeru-runtimes:certified-11-jdk-ubi
- IBM Semeru Runtimes Java 11 Certified Edition on Ubuntu:
FROM icr.io/appcafe/ibm-semeru-runtimes:certified-11-jre-focal
orFROM icr.io/appcafe/ibm-semeru-runtimes:certified-11-jdk-focal
- IBM Semeru Runtimes Java 17 Certified Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:certified-17-jre-ubi
orFROM icr.io/appcafe/ibm-semeru-runtimes:certified-17-jdk-ubi
- IBM Semeru Runtimes Java 17 Certified Edition on Ubuntu:
FROM icr.io/appcafe/ibm-semeru-runtimes:certified-17-jre-focal
orFROM icr.io/appcafe/ibm-semeru-runtimes:certified-17-jdk-focal
- See all tags:
curl -s https://icr.io/v2/appcafe/ibm-semeru-runtimes/tags/list | jq .tags
- IBM Semeru Runtimes Java 8 Open Edition on UBI:
- DockerHub
- IBM Semeru Runtimes:
- IBM Semeru
Runtimes Java 8 Open Edition on CentOS:
FROM docker.io/ibm-semeru-runtimes:open-8-jre-centos7
orFROM docker.io/ibm-semeru-runtimes:open-8-jdk-centos7
- IBM Semeru
Runtimes Java 8 Open Edition on Ubuntu:
FROM docker.io/ibm-semeru-runtimes:open-8-jre-focal
orFROM docker.io/ibm-semeru-runtimes:open-8-jdk-focal
- IBM Semeru
Runtimes Java 11 Open Edition on CentOS:
FROM docker.io/ibm-semeru-runtimes:open-11-jre-centos7
orFROM docker.io/ibm-semeru-runtimes:open-11-jdk-centos7
- IBM Semeru
Runtimes Java 11 Open Edition on Ubuntu:
FROM docker.io/ibm-semeru-runtimes:open-11-jre-focal
orFROM docker.io/ibm-semeru-runtimes:open-11-jdk-focal
- IBM Semeru
Runtimes Java 17 Open Edition on CentOS:
FROM docker.io/ibm-semeru-runtimes:open-17-jre-centos7
orFROM docker.io/ibm-semeru-runtimes:open-17-jdk-centos7
- IBM Semeru
Runtimes Java 17 Open Edition on Ubuntu:
FROM docker.io/ibm-semeru-runtimes:open-17-jre-focal
orFROM docker.io/ibm-semeru-runtimes:open-17-jdk-focal
- See all IBM Semeru Runtimes tags:
curl -L -s "https://registry.hub.docker.com/v2/repositories/library/ibm-semeru-runtimes/tags?page=1&page_size=100" | jq '.results[].name'
- IBM Semeru
Runtimes Java 8 Open Edition on CentOS:
- IBM Java:
- IBM Java 8 on Ubuntu:
FROM docker.io/ibmjava:8-jre
orFROM docker.io/ibmjava:8-sdk
- IBM Java 8 on Alpine:
FROM docker.io/ibmjava:8-jre-alpine
orFROM docker.io/ibmjava:8-sdk-alpine
- See all IBM Java 8 tags:
curl -L -s "https://registry.hub.docker.com/v2/repositories/library/ibmjava/tags?page=1&page_size=100" | jq '.results[].name'
- IBM Java 8 on Ubuntu:
- IBM Semeru Runtimes:
Run Examples
Compile and run a simple Java program:
podman run --rm icr.io/appcafe/ibm-semeru-runtimes:certified-17-jdk-ubi sh -c "cd /tmp; printf 'public class main { public static void main(String... args) throws Throwable { System.out.println(\"Hello World\"); } }' > main.java && javac main.java && java -showversion main"
Run a program in the background and do something on it:
podman run --rm icr.io/appcafe/ibm-semeru-runtimes:certified-17-jdk-ubi sh -c "cd /tmp; printf 'public class main { public static void main(String... args) throws Throwable { System.out.println(\"Hello World\"); Object o = new Object(); synchronized (o) { o.wait(); } } }' > main.java && javac main.java && (java main &); sleep 1; jcmd \$(jps | grep -v Jps | sed 's/ main//g') Dump.java; sleep 1; head javacore*txt"
To start an interactive session, add -it
after
--rm
. For example:
podman run --rm -it icr.io/appcafe/ibm-semeru-runtimes:certified-17-jdk-ubi bash