Packaging Red Hat build of OpenJDK 21 applications in containers


Red Hat build of OpenJDK 21

Red Hat Customer Content Services

Abstract

Red Hat build of OpenJDK is a Red Hat offering on the Red Hat Enterprise Linux platform. The Packaging Red Hat build of OpenJDK 21 applications in containers guide provides an overview of this product and explains how to package the applications in a container.

Providing feedback on Red Hat build of OpenJDK documentation

To report an error or to improve our documentation, log in to your Red Hat Jira account and submit an issue. If you do not have a Red Hat Jira account, then you will be prompted to create an account.

Procedure

  1. Click the following link to create a ticket.
  2. Enter a brief description of the issue in the Summary.
  3. Provide a detailed description of the issue or enhancement in the Description. Include a URL to where the issue occurs in the documentation.
  4. Clicking Submit creates and routes the issue to the appropriate documentation team.

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.

Chapter 1. Red Hat build of OpenJDK applications in containers

Red Hat build of 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 Java applications in the /deployments directory of the OpenJDK image are run when the image loads.

Note

Containers that contain Red Hat build of OpenJDK applications are not automatically updated with security updates. Ensure that you update these images at least once every three months.

Application 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 /deployments directory.

Chapter 2. Deploying Red Hat build of OpenJDK application in containers

You can deploy Red Hat build of OpenJDK applications in containers and have them run when the container is loaded.

Procedure

  • Copy the application JAR to the /deployments directory in the image JAR file.

    For example, the following shows a brief Dockerfile that adds an application called testubi.jar to the Red Hat build of OpenJDK 21 UBI8 image:

    FROM registry.access.redhat.com/ubi8/openjdk-17
    
    COPY target/testubi.jar /deployments/testubi.jar

Chapter 3. Updating Red Hat build of OpenJDK container images

To ensure that an Red Hat build of OpenJDK container with Java applications includes the latest security updates, rebuild the container.

Procedure

  1. Pull the base Red Hat build of OpenJDK image.
  2. Deploy the Red Hat build of OpenJDK application. For more information, see Deploying Red Hat build of OpenJDK applications in containers.

    The Red Hat build of OpenJDK container with the Red Hat build of OpenJDK application is updated.

Additional resources

Revised on 2024-05-09 14:48:54 UTC

Legal Notice

Copyright © 2024 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.