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

Red Hat build of OpenJDK 11

Red Hat Customer Content Services

摘要

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

使开源包含更多

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

对红帽文档提供反馈

我们感谢您对我们文档的反馈。要提供反馈,您可以突出显示文档中的文本并添加注释。

本节介绍如何提交反馈。

先决条件

  • 已登陆到红帽客户门户网站。
  • 在红帽客户门户中,以多页 HTML 格式查看文档。

流程

要提供反馈,请执行以下步骤:

  1. 点文档右上角的反馈按钮查看现有的反馈。

    注意

    反馈功能仅在多页 HTML 格式中启用。

  2. 高亮标记您要提供反馈的文档中的部分。
  3. 点在高亮文本旁弹出的 Add Feedback

    文本框将在页面右侧的"反馈"部分中打开。

  4. 在文本框中输入您的反馈,然后点 Submit

    创建了一个与文档相关的问题。

  5. 要查看问题,请单击反馈视图中的问题跟踪器链接。

第 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 11 UBI8 镜像:

    FROM registry.access.redhat.com/ubi8/openjdk-11
    
    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 容器被更新。

其他资源

更新于 2023-09-20

法律通告

Copyright © 2023 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.