Packaging OpenJDK 8 applications in containers
Making open source more inclusive
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Providing feedback on Red Hat documentation
We appreciate your feedback on our documentation. To provide feedback, you can highlight the text in a document and add comments.
This section explains how to submit feedback.
- You are logged in to the Red Hat Customer Portal.
- In the Red Hat Customer Portal, view the document in Multi-page HTML format.
To provide your feedback, perform the following steps:
Click the Feedback button in the top-right corner of the document to see existing feedback.Note
The feedback feature is enabled only in the Multi-page HTML format.
- Highlight the section of the document where you want to provide feedback.
Click the Add Feedback pop-up that appears near the highlighted text.
A text box appears in the feedback section on the right side of the page.
Enter your feedback in the text box and click Submit.
A documentation issue is created.
- To view the issue, click the issue tracker link in the feedback view.
Chapter 1. OpenJDK applications in containers
OpenJDK images have default startup scripts that automatically detect application
JAR files and launch Java. The script’s behavior can be customized using environment variables. For more information, see
/help.md in the container.
The OpenJDK applications in the
/deployments directory of the OpenJDK image are run when the image loads.
Containers that contain OpenJDK applications are not automatically updated with security updates. Ensure that you update these images at least once every three months.
JAR files can be fat JARs or thin JARs.
- Fat JARs contain all of the application’s dependencies.
Thin JARs reference other JARs that contain some, or all, of the application’s dependencies.
Thin JARs are only supported if:
- They have a flat classpath.
All dependencies are JARs that are in the
Chapter 2. Deploying OpenJDK applications in containers
You can deploy OpenJDK applications in containers and have them run when the container is loaded.
Copy the application
/deploymentsdirectory in the image
For example, the following shows a brief Dockerfile that adds an application called
testubi.jarto the OpenJDK 8 UBI8 image:
FROM registry.access.redhat.com/ubi8/openjdk-8 COPY target/testubi.jar /deployments/testubi.jar
Chapter 3. Updating OpenJDK container images
To ensure that an OpenJDK container with Java applications includes the latest security updates, rebuild the container.
- Pull the base OpenJDK image.
Deploy the OpenJDK application. For more information, see Deploying OpenJDK applications in containers.
The OpenJDK container with the OpenJDK application is updated.
- For more information, see Red Hat OpenJDK Container images.