Red Hat provides the Red Hat build of OpenJDK for running Java applications on Red Hat OpenShift 4. Developers can use the standalone Source-to-Image (S2I) CLI to build and test OpenJDK container images locally before deploying to a cluster. S2I produces reproducible images by injecting source code into a builder image and running its assemble script. The toolkit supports flags such as –loglevel for detailed output, –environment-file to pass custom JVM settings like G1GC and MaxRAMPercentage, and –as-dockerfile to output a Dockerfile. After building, the image can be tested locally with docker run, then uploaded to the cluster for deployment.
Context
Red Hat provides the Red Hat build of OpenJDK for running Java applications on Red Hat OpenShift 4. While OpenShift can manage container builds on-cluster, developers may want to build and test OpenJDK images locally before deploying. The standalone Source-to-Image (S2I) toolkit enables this local workflow without requiring additional build tools such as Shipwright or Jenkins.
Approach / What changed
Use the standalone Source-to-Image (S2I) CLI to build OpenJDK container images locally from source code. The S2I toolkit injects source into a builder image (e.g., registry.access.redhat.com/ubi8/openjdk-17) and runs the assemble script to produce a ready-to-run image. Developers can pass flags such as –loglevel for detailed output, –environment-file to supply custom environment variables like MAVEN_OPTS for JVM tuning, and –as-dockerfile to output a Dockerfile instead of building directly. The resulting image can be tested locally with docker run before deployment to OpenShift.
Takeaways
1
The standalone S2I CLI builds reproducible container images from source code by injecting it into a builder image and running the assemble script, without requiring Shipwright or Jenkins.
2
Use the –environment-file flag to pass custom JVM options such as -XX:+UseG1GC and -XX:MaxRAMPercentage=47.0 to override default settings like ParallelGC.
3
S2I builds execute a standard Maven build; they package the application but do not automatically convert a WAR file into an executable JAR unless configured in pom.xml or build scripts.
FAQ
How do I customize JVM settings in an S2I build?
Use the --environment-file flag to pass a file containing environment variables. For example, you can define MAVEN_OPTS with JVM flags like -XX:+UseG1GC and -XX:MaxRAMPercentage=47.0 in a file and pass it with s2i build --environment-file=/path/to/file.
Does S2I automatically convert WAR files to executable JARs?
The S2I process executes a standard Maven build. It packages your application but does not automatically convert a standard WAR file into an executable JAR unless configured in your pom.xml or build scripts.
How do I resolve socket or permission errors during S2I builds?
Ensure the Docker daemon is running and that your user has access to the container engine socket. You can also specify build permissions explicitly using the --assemble-user flag.
Argo CD is a GitOps controller that treats Git as the desired state and continuously reconciles it against what actually runs in each cluster. It maps the parts of that loop and why pull-based agents change its scale.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.