2.5. 覆盖 bootc 镜像的版本


Red Hat Enterprise Linux (RHEL)基础镜像、通用基础镜像(UBI)和 rhel-bootc 使用只跟踪主要操作系统版本的版本号。要为派生镜像定义特定的版本号,您可以通过将 version 标签添加到 Containerfile 来覆盖这个值。

先决条件

  • container-tools 元数据包已安装。

流程

  1. 创建 Containerfile :

    FROM registry.redhat.io/rhel10/rhel-bootc:latest
    # In this example, the custom operating system has its own
    # version scheme.
    # The operating system major version is copied
    # and a sub-version of it is added, which represents a point-in-time
    # snapshot of the base OS content.
    # This just changes the output of bootc status. A deeper level
    # of customization is available by also changing the contents of /usr/lib/os-release.
    # Define the custom version and release metadata
    LABEL org.opencontainers.image.version=”10.1.1”
  2. 使用当前目录中的 Containerfile 构建 & lt;image> 镜像:

    $ podman build -t quay.io/<namespace>/<image>:<tag> .

验证

  • 验证是否应用了覆盖:

    $ podman inspect <image-name> --format '{{index .Labels "org.opencontainers.image.version"}}'
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

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

让开源更具包容性

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

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部