名称

podman-manifest - 创建和操作清单列表和镜像索引

简介

podman manifest 子命令

描述

podman manifest 命令提供子命令,可用于:

* Create a working Docker manifest list or OCI image index.

子命令

命令

手册页

描述

add

podman-manifest-add(1)

向清单列表或镜像索引添加镜像或工件。

annotate

podman-manifest-annotate(1)

在清单列表或镜像索引中添加和更新有关镜像或工件的信息。

create

podman-manifest-create(1)

创建清单列表或镜像索引。

exists

podman-manifest-exists(1)

检查给定的清单列表是否存在于本地存储中。

inspect

podman-manifest-inspect(1)

显示清单列表或镜像索引。

push

podman-manifest-push(1)

将清单列表或镜像索引推送到注册表。

remove

podman-manifest-remove(1)

从清单列表或镜像索引中删除项目。

rm

podman-manifest-rm(1)

从本地存储中删除清单列表或镜像索引。

示例

从 Containerfile 构建多架构清单列表

假设 Containerfile 使用 RUN 指令,则宿主机需要一种执行非原生二进制文件的方法。配置此操作超出了本示例的范围。可以像这样在 4 个线程中并行构建多架构清单列表 shazam

    $ platarch=linux/amd64,linux/ppc64le,linux/arm64,linux/s390x
    $ podman build --jobs=4 --platform=$platarch --manifest shazam .

注意: --jobs 参数是可选的。在构建多架构清单列表时,请勿使用 podman build 命令的 --tag(或 -t)选项。

从单独构建的镜像组装多架构清单

假设 example.com/example/shazam:$arch 镜像在其他宿主机上单独构建并推送到 example.com 注册表。它们可以组合成一个清单列表,并使用简单的循环进行推送:

    $ REPO=example.com/example/shazam
    $ podman manifest create $REPO:latest
    $ for IMGTAG in amd64 s390x ppc64le arm64; do \
              podman manifest add $REPO:latest docker://$REPO:IMGTAG; \
          done
    $ podman manifest push --all $REPO:latest

注意: add 指令参数顺序是 <manifest> 后跟 <image>。此外,需要 --all 推送选项以确保所有内容都已推送,而不仅仅是原生平台/架构。

推送前删除并标记清单列表

与内容不同,删除和推送清单列表需要特别注意。您几乎总是需要使用 manifest rmmanifest push --all 子命令。例如,可以像这样执行重命名和推送:

    $ podman tag localhost/shazam example.com/example/shazam
    $ podman manifest rm localhost/shazam
    $ podman manifest push --all example.com/example/shazam

另请参阅

podman(1), podman-manifest-add(1), podman-manifest-annotate(1), podman-manifest-create(1), podman-manifest-inspect(1), podman-manifest-push(1), podman-manifest-remove(1)