Java J9 in Containers
IBM and Semeru Java in Containers
Recipe
- In general, tune
-XX:MaxRAMPercentageand-XX:InitialRAMPercentageinstead of-Xmxand-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:+ClassRelationshipVerifierto 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 Semeru Runtimes common images:
- IBM Semeru Runtimes Java 25 Open Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:open-25-jdk-ubi - IBM Semeru Runtimes Java 21 Open Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:open-21-jdk-ubi - IBM Semeru Runtimes Java 17 Open Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:open-17-jdk-ubi - IBM Semeru Runtimes Java 11 Open Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:open-11-jdk-ubi - IBM Semeru Runtimes Java 8 Open Edition on UBI:
FROM icr.io/appcafe/ibm-semeru-runtimes:open-8-jdk-ubi - See all tags:
curl -s https://icr.io/v2/appcafe/ibm-semeru-runtimes/tags/list | jq .tags
- IBM Semeru Runtimes Java 25 Open Edition on UBI:
- IBM
Java 8 common images:
- IBM Java 8 on UBI:
FROM icr.io/appcafe/ibmjava:8-sdk-ubi8 - IBM
Java 8 for z/OS:
FROM icr.io/zoscp/ibmjava:8 - See all tags:
curl -s https://icr.io/v2/appcafe/ibmjava/tags/list | jq .tags
- IBM Java 8 on UBI:
Run Examples
Compile and run a simple Java program:
podman run --platform linux/amd64 --rm icr.io/appcafe/ibm-semeru-runtimes:open-21-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 --platform linux/amd64 --rm icr.io/appcafe/ibm-semeru-runtimes:open-21-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 --platform linux/amd64 --rm -it icr.io/appcafe/ibm-semeru-runtimes:open-17-jdk-ubi bash