在容器中打包红帽构建的 OpenJDK 21 应用程序


Red Hat build of OpenJDK 21

Red Hat Customer Content Services

摘要

Red Hat build of OpenJDK 是 Red Hat Enterprise Linux 平台上的红帽产品。容器指南中的红帽构建的 OpenJDK 21 应用程序 概述此产品,并解释了如何在容器中打包应用程序。

提供有关红帽构建的 OpenJDK 文档的反馈

要报告错误或改进文档,请登录到 Red Hat JIRA 帐户并提交问题。如果您没有 Red Hat Jira 帐户,则会提示您创建一个帐户。

流程

  1. 单击以下链接 以创建 ticket
  2. Summary 中输入问题的简短描述。
  3. Description 中提供问题或功能增强的详细描述。包括一个指向文档中问题的 URL。
  4. Submit 创建问题,并将问题路由到适当的文档团队。

使开源包含更多

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。我们从这四个术语开始:master、slave、黑名单和白名单。由于此项工作十分艰巨,这些更改将在即将推出的几个发行版本中逐步实施。详情请查看 CTO Chris Wright 的信息

第 1 章 红帽在容器中构建 OpenJDK 应用程序

红帽构建的 OpenJDK 镜像具有默认启动脚本,可自动检测应用程序 JAR 文件并启动 Java。脚本的行为可以使用环境变量自定义。如需更多信息,请参阅容器中的 /help.md

当镜像加载时,OpenJDK 镜像的 /deployments 目录中的 Java 应用程序将运行。

注意

包含红帽构建的 OpenJDK 应用程序的容器不会自动更新。确保您至少每三个月更新这些镜像。

应用程序 JAR 文件可以是 fat JAR 或精简 JAR。

  • FAT JAR 包含应用程序的所有依赖项。
  • 精简 JAR 引用包含应用依赖项的一些或全部其他 JAR。

    只有在以下情况下支持精简 JAR:

    • 它们具有扁平类路径。
    • 所有依赖项都是位于 /deployments 目录中的 JAR。

第 2 章 在容器中部署红帽构建的 OpenJDK 应用程序

您可以在容器中部署红帽构建的 OpenJDK 应用程序,并在容器加载时运行它们。

流程

  • 将应用 JAR 复制到镜像 JAR 文件中的 /deployments 目录。

    例如,下面显示了一个简短的 Dockerfile,它将名为 testubi.jar 的应用程序添加到红帽构建的 OpenJDK 21 UBI8 镜像:

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

第 3 章 更新红帽构建的 OpenJDK 容器镜像

为确保红帽使用 Java 应用程序的 OpenJDK 容器构建包括最新的安全更新,请重新构建容器。

流程

  1. 拉取红帽构建的 OpenJDK 镜像。
  2. 部署红帽构建的 OpenJDK 应用程序。如需更多信息,请参阅在 容器中部署 OpenJDK 应用程序的红帽构建

    使用 Red Hat build of OpenJDK 应用程序的 Red Hat build of OpenJDK 容器被更新。

其他资源

更新于 2024-05-10

法律通告

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

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat, Inc.