2.5. 覆盖 bootc 镜像的版本
Red Hat Enterprise Linux (RHEL)基础镜像、通用基础镜像(UBI)和 rhel-bootc 使用只跟踪主要操作系统版本的版本号。要为派生镜像定义特定的版本号,您可以通过将 version 标签添加到 Containerfile 来覆盖这个值。
先决条件
-
container-tools元数据包已安装。
流程
创建 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”使用当前目录中的
Containerfile构建<image> 镜像:$ podman build -t quay.io/<namespace>/<image>:<tag> .
验证
验证是否应用了覆盖:
$ podman inspect <image-name> --format '{{index .Labels "org.opencontainers.image.version"}}'