Skip to content

Instantly share code, notes, and snippets.

@diegolovison
Created December 9, 2025 15:10
Show Gist options
  • Select an option

  • Save diegolovison/2305ebe63fd34259696c67f0f23b436b to your computer and use it in GitHub Desktop.

Select an option

Save diegolovison/2305ebe63fd34259696c67f0f23b436b to your computer and use it in GitHub Desktop.
Having fun with containers with custom JVM args
  • Create a temporary folder on the host machine
mkdir -p /tmp/output
chmod 777 /tmp/output
  • Run the container
docker run -it --rm \
  --user jboss \
  --cpus="5.0" \
  --memory="1g" \
  -v /tmp/output:/home/jboss:Z \
  registry.access.redhat.com/ubi8/openjdk-8:1.15-1.1682399183 \
  /bin/bash

Within the container

pwd
java -XshowSettings:system -version
echo "public class CpuLoad { public static void main(String[] a) { long end = System.currentTimeMillis() + 60000; while (System.currentTimeMillis() < end) { Math.tan(Math.random()); } } }" > CpuLoad.java
javac CpuLoad.java
java -XshowSettings:system -XX:StartFlightRecording=duration=60s,filename=data.jfr CpuLoad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment