×

可以通过从私有注册表中镜像的 OpenShift Container Platform 容器镜像集安装集群,在没有直接互联网连接的受限网络中运行集群。只要集群运行,此注册表就必须始终运行。有关更多信息,请参阅先决条件部分。

您可以使用 oc-mirror OpenShift CLI (oc) 插件将镜像镜像到完全或部分断开连接的环境中的镜像注册表。您必须从具有互联网连接的系统运行 oc-mirror,才能从官方 Red Hat 注册表下载所需的镜像。

关于 oc-mirror 插件

您可以使用 oc-mirror OpenShift CLI (oc) 插件使用单个工具将所有必需的 OpenShift Container Platform 内容和其他镜像镜像到您的镜像注册表。它提供以下功能:

  • 提供镜像 OpenShift Container Platform 版本、运算符、helm 图表和其他镜像的集中方法。

  • 维护 OpenShift Container Platform 和运算符的更新路径。

  • 使用声明性镜像集配置文件仅包含集群所需的 OpenShift Container Platform 版本、运算符和镜像。

  • 执行增量镜像,从而减少未来镜像集的大小。

  • 从目标镜像注册表中修剪自上次执行以来已从镜像集配置中排除的镜像。

  • 可选地生成支持 OpenShift 更新服务 (OSUS) 使用的工件。

使用 oc-mirror 插件时,您可以在镜像集配置文件中指定要镜像的内容。在此 YAML 文件中,您可以微调配置,只包含集群所需的 OpenShift Container Platform 版本和运算符。这减少了您需要下载和传输的数据量。oc-mirror 插件还可以镜像任意 helm 图表和其他容器镜像,以帮助用户无缝地将其工作负载同步到镜像注册表。

第一次运行 oc-mirror 插件时,它会使用执行断开连接集群安装或更新所需的内容填充镜像注册表。为了使您的断开连接集群继续接收更新,您必须保持镜像注册表的更新。要更新镜像注册表,请使用与第一次运行时相同的配置运行 oc-mirror 插件。oc-mirror 插件引用存储后端中的元数据,并且仅下载自上次运行该工具以来已发布的内容。这为 OpenShift Container Platform 和运算符提供了更新路径,并根据需要执行依赖项解析。

高级工作流程

以下步骤概述了如何使用 oc-mirror 插件将镜像镜像到镜像注册表的高级工作流程:

  1. 创建镜像集配置文件。

  2. 使用以下方法之一将镜像集镜像到目标镜像注册表:

    • 将镜像集直接镜像到目标镜像注册表。

    • 将镜像集镜像到磁盘,将镜像集传输到目标环境,然后将镜像集上传到目标镜像注册表。

  3. 配置集群以使用 oc-mirror 插件生成的资源。

  4. 根据需要重复这些步骤以更新目标镜像注册表。

使用 oc-mirror CLI 插件填充镜像注册表时,对目标镜像注册表的任何进一步更新都必须使用 oc-mirror 插件进行。

oc-mirror 插件兼容性和支持

oc-mirror 插件支持镜像 OpenShift Container Platform 版本 4.12 和更高版本的 OpenShift Container Platform 有效负载镜像和运算符目录。

aarch64ppc64les390x 架构上,oc-mirror 插件仅支持 OpenShift Container Platform 版本 4.14 和更高版本。

无论您需要镜像哪些版本的 OpenShift Container Platform,都应使用最新版本的 oc-mirror 插件。

其他资源

关于镜像注册表

您可以将 OpenShift Container Platform 安装和后续产品更新所需的镜像镜像到支持Docker v2-2的容器镜像注册表,例如 Red Hat Quay。如果您无法访问大型容器注册表,您可以使用Red Hat OpenShift 的镜像注册表,这是一个包含在 OpenShift Container Platform 订阅中的小型容器注册表。

无论您选择哪个注册表,将内容从 Red Hat 托管的互联网站点镜像到隔离的镜像注册表的过程都是相同的。镜像内容后,您需要将每个集群配置为从您的镜像注册表检索此内容。

OpenShift 镜像注册表不能用作目标注册表,因为它不支持在镜像过程中所需的无标签推送。

如果选择非Red Hat OpenShift 镜像注册表的容器注册表,则您配置的集群中的每台机器都必须能够访问它。如果注册表不可访问,则安装、更新或正常操作(如工作负载迁移)可能会失败。因此,您必须以高可用性的方式运行镜像注册表,并且镜像注册表的生产可用性至少要与您的 OpenShift Container Platform 集群的生产可用性匹配。

当您使用 OpenShift Container Platform 镜像填充镜像注册表时,您可以遵循两种方案。如果您有一台既可以访问互联网又可以访问您的镜像注册表但不能访问您的集群节点的主机,则可以直接从该机器镜像内容。此过程称为连接镜像。如果您没有这样的主机,则必须将镜像镜像到文件系统,然后将该主机或可移动介质带入您的受限环境。此过程称为断开连接镜像

对于镜像注册表,要查看拉取镜像的来源,您必须查看 CRI-O 日志中的正在尝试访问日志条目。其他查看镜像拉取来源的方法(例如,在节点上使用crictl images命令)会显示非镜像镜像名称,即使镜像是从镜像位置拉取的。

Red Hat 不对 OpenShift Container Platform 测试第三方注册表。

其他资源

先决条件

  • 您必须在将托管 OpenShift Container Platform 集群的位置(例如 Red Hat Quay)拥有一个支持Docker v2-2的容器镜像注册表。

    如果您使用 Red Hat Quay,则必须使用 3.6 或更高版本以及 oc-mirror 插件。如果您有权使用 Red Hat Quay,请参阅有关部署 Red Hat Quay 的文档,了解概念验证目的使用 Red Hat Quay Operator 的方法。如果您需要有关选择和安装注册表的更多帮助,请联系您的销售代表或 Red Hat 支持。

    如果您还没有现有的容器镜像注册表解决方案,OpenShift Container Platform 的订阅者将获得一个Red Hat OpenShift 镜像注册表Red Hat OpenShift 镜像注册表包含在您的订阅中,它是一个小型容器注册表,可用于在断开连接的安装中镜像 OpenShift Container Platform 的所需容器镜像。

准备镜像主机

在您可以使用 oc-mirror 插件镜像镜像之前,您必须安装该插件并创建一个容器镜像注册表凭据文件,以允许从 Red Hat 镜像到您的镜像。

安装 oc-mirror OpenShift CLI 插件

安装 oc-mirror OpenShift CLI 插件以管理断开连接环境中的镜像集。

先决条件
  • 您已安装 OpenShift CLI(oc)。如果您在完全断开连接的环境中镜像镜像集,请确保以下几点:

    • 您已在具有互联网访问权限的主机上安装了 oc-mirror 插件。

    • 断开连接环境中的主机可以访问目标镜像注册表。

  • 您已将使用 oc-mirror 的操作系统的umask参数设置为0022

  • 您已安装了您正在使用的 RHEL 版本的正确二进制文件。

步骤
  1. 下载 oc-mirror CLI 插件

    1. 导航到 Red Hat Hybrid Cloud Console 的下载页面。

    2. OpenShift 断开连接安装工具部分,从下拉菜单中选择OpenShift 客户端 (oc) 镜像插件操作系统类型架构类型

    3. 单击下载以保存文件。

  2. 通过运行以下命令解压缩存档:

    $ tar xvzf oc-mirror.tar.gz
  3. 如有必要,通过运行以下命令更新插件文件使其可执行:

    $ chmod +x oc-mirror

    请勿重命名oc-mirror文件。

  4. 通过将文件放在您的PATH中(例如/usr/local/bin)来安装 oc-mirror CLI 插件,运行以下命令:

    $ sudo mv oc-mirror /usr/local/bin/.
验证
  • 通过运行以下命令验证 oc-mirror 插件 v1 是否已成功安装:

    $ oc mirror help

配置允许镜像镜像的凭据

创建一个容器镜像注册表凭据文件,使您可以将镜像从 Red Hat 镜像到您的镜像。

安装集群时,请勿将此镜像注册表凭据文件用作拉取密钥。如果您在安装集群时提供此文件,则集群中的所有机器都将具有对镜像注册表的写入访问权限。

先决条件
  • 您已配置要在断开连接的环境中使用的镜像注册表。

  • 您已确定镜像注册表上的镜像存储库位置以将镜像镜像到其中。

  • 您已配置允许将镜像上传到该镜像存储库的镜像注册表帐户。

  • 您可以写入镜像注册表。

步骤

在安装主机上完成以下步骤:

  1. 从 Red Hat OpenShift 集群管理器下载您的registry.redhat.io拉取密钥

  2. 通过运行以下命令创建拉取密钥的 JSON 格式副本:

    $ cat ./pull-secret | jq . > <path>/<pull_secret_file_in_json> (1)
    1 指定要存储拉取密钥的文件夹的路径以及要创建的 JSON 文件的名称。
    拉取密钥示例:
    {
      "auths": {
        "cloud.openshift.com": {
          "auth": "b3BlbnNo...",
          "email": "[email protected]"
        },
        "quay.io": {
          "auth": "b3BlbnNo...",
          "email": "[email protected]"
        },
        "registry.connect.redhat.com": {
          "auth": "NTE3Njg5Nj...",
          "email": "[email protected]"
        },
        "registry.redhat.io": {
          "auth": "NTE3Njg5Nj...",
          "email": "[email protected]"
        }
      }
    }
  3. 将文件保存为~/.docker/config.json$XDG_RUNTIME_DIR/containers/auth.json

    1. 如果.docker$XDG_RUNTIME_DIR/containers目录不存在,请通过输入以下命令创建一个:

      $ mkdir -p <directory_name>

      其中<directory_name>~/.docker$XDG_RUNTIME_DIR/containers

    2. 通过输入以下命令将拉取密钥复制到相应的目录:

      $ cp <path>/<pull_secret_file_in_json> <directory_name>/<auth_file>

      其中<directory_name>~/.docker$XDG_RUNTIME_DIR/containers<auth_file>config.jsonauth.json

  4. 通过运行以下命令生成镜像注册表的 base64 编码用户名和密码或令牌:

    $ echo -n '<user_name>:<password>' | base64 -w0 (1)
    1 对于<user_name><password>,请指定您为注册表配置的用户名和密码。
    示例输出:
    BGVtbYk3ZHAtqXs=
  5. 编辑 JSON 文件并添加一个描述您的注册表的章节:

      "auths": {
        "<mirror_registry>": { (1)
          "auth": "<credentials>", (2)
          "email": "[email protected]"
        }
      },
    1 指定镜像注册表用于提供内容的注册表域名,以及可选的端口。例如,registry.example.comregistry.example.com:8443
    2 指定镜像注册表的 base64 编码用户名和密码。
    示例修改后的拉取密钥
    {
      "auths": {
        "registry.example.com": {
          "auth": "BGVtbYk3ZHAtqXs=",
          "email": "[email protected]"
        },
        "cloud.openshift.com": {
          "auth": "b3BlbnNo...",
          "email": "[email protected]"
        },
        "quay.io": {
          "auth": "b3BlbnNo...",
          "email": "[email protected]"
        },
        "registry.connect.redhat.com": {
          "auth": "NTE3Njg5Nj...",
          "email": "[email protected]"
        },
        "registry.redhat.io": {
          "auth": "NTE3Njg5Nj...",
          "email": "[email protected]"
        }
      }
    }

创建镜像集配置

在使用 oc-mirror 插件镜像镜像集之前,必须创建一个镜像集配置文件。此镜像集配置文件定义了要镜像哪些 OpenShift Container Platform 版本、Operators 和其他镜像,以及 oc-mirror 插件的其他配置设置。

必须在镜像集配置文件中指定一个存储后端。此存储后端可以是本地目录或支持Docker v2-2的注册表。oc-mirror 插件在创建镜像集期间将元数据存储在此存储后端中。

请勿删除或修改 oc-mirror 插件生成的元数据。每次对同一镜像注册表运行 oc-mirror 插件时,都必须使用相同的存储后端。

先决条件
  • 您已创建容器镜像注册表凭据文件。有关说明,请参见“配置允许镜像镜像的凭据”。

步骤
  1. 使用oc mirror init命令创建镜像集配置模板,并将其保存到名为imageset-config.yaml的文件中。

    $ oc mirror init <--registry <storage_backend> > imageset-config.yaml (1)
    1 指定存储后端的位置,例如example.com/mirror/oc-mirror-metadata
  2. 编辑文件并根据需要调整设置。

    kind: ImageSetConfiguration
    apiVersion: mirror.openshift.io/v1alpha2
    archiveSize: 4                                                      (1)
    storageConfig:                                                      (2)
      registry:
        imageURL: example.com/mirror/oc-mirror-metadata                 (3)
        skipTLS: false
    mirror:
      platform:
        channels:
        - name: stable-4.17                                             (4)
          type: ocp
        graph: true                                                     (5)
      operators:
      - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17  (6)
        packages:
        - name: serverless-operator                                     (7)
          channels:
          - name: stable                                                (8)
      additionalImages:
      - name: registry.redhat.io/ubi9/ubi:latest                        (9)
      helm: {}
    1 添加archiveSize以设置镜像集内每个文件的最大大小(以 GiB 为单位)。
    2 设置保存镜像集元数据的后端位置。此位置可以是注册表或本地目录。必须指定storageConfig值。
    3 设置存储后端的注册表 URL。
    4 设置从中检索 OpenShift Container Platform 镜像的通道。
    5 添加graph: true以构建并将图数据镜像推送到镜像注册表。图数据镜像是创建 OpenShift Update Service (OSUS) 所必需的。graph: true字段还会生成UpdateService自定义资源清单。oc命令行界面 (CLI) 可以使用UpdateService自定义资源清单来创建 OSUS。有关更多信息,请参见《关于 OpenShift Update Service》。
    6 设置从中检索 OpenShift Container Platform 镜像的 Operator 目录。
    7 仅指定要包含在镜像集中的某些 Operator 包。删除此字段可检索目录中的所有包。
    8 仅指定要包含在镜像集中的 Operator 包的某些通道。即使您不使用该通道中的 bundle,也必须始终包含 Operator 包的默认通道。您可以通过运行以下命令查找默认通道:oc mirror list operators --catalog=<catalog_name> --package=<package_name>
    9 指定要包含在镜像集中的任何其他镜像。

    graph: true字段还会镜像ubi-micro镜像以及其他镜像镜像。

    升级 OpenShift Container Platform 扩展更新支持 (EUS) 版本时,当前版本和目标版本之间可能需要中间版本。例如,如果当前版本是4.14,目标版本是4.16,则在使用 oc-mirror 插件 v1 时,可能需要在ImageSetConfiguration中包含4.15.8之类的版本。

    oc-mirror 插件 v1 可能并不总是能自动检测到这一点,因此请检查Cincinnati 图表网页以确认任何所需的中间版本,并将其手动添加到您的配置中。

    有关参数的完整列表,请参见“镜像集配置参数”;有关各种镜像用例,请参见“镜像集配置示例”。

  3. 保存更新后的文件。

    镜像内容时,oc mirror命令需要此镜像集配置文件。

将镜像集镜像到镜像注册表

您可以使用 oc-mirror CLI 插件将镜像镜像到部分断开连接的环境完全断开连接的环境中的镜像注册表。

这些过程假设您已设置镜像注册表。

在部分断开连接的环境中镜像镜像集

在部分断开连接的环境中,您可以将镜像集直接镜像到目标镜像注册表。

从镜像到镜像的镜像

您可以使用 oc-mirror 插件将镜像集直接镜像到在创建镜像集期间可访问的目标镜像注册表。

您需要在镜像集配置文件中指定一个存储后端。此存储后端可以是本地目录或 Docker v2 注册表。oc-mirror 插件在创建镜像集期间将元数据存储在此存储后端中。

请勿删除或修改 oc-mirror 插件生成的元数据。每次对同一镜像注册表运行 oc-mirror 插件时,都必须使用相同的存储后端。

先决条件
  • 您可以访问互联网以获取必要的容器镜像。

  • 您已安装 OpenShift CLI (oc)。

  • 您已安装oc-mirror CLI 插件。

  • 您已创建镜像集配置文件。

步骤
  • 运行oc mirror命令将镜像从指定的镜像集配置镜像到指定的注册表。

    $ oc mirror --config=./<imageset-config.yaml> \(1)
      docker://registry.example:5000             (2)
    1 指定您创建的镜像集配置文件。例如,imageset-config.yaml
    2 指定要将镜像集文件镜像到的注册表。注册表必须以docker://开头。如果为镜像注册表指定顶级命名空间,则必须在后续执行中也使用相同的命名空间。
验证
  1. 导航到生成的oc-mirror-workspace/目录。

  2. 导航到结果目录,例如results-1639608409/

  3. 验证ImageContentSourcePolicyCatalogSource资源是否存在 YAML 文件。

ImageContentSourcePolicy YAML 文件的repositoryDigestMirrors部分用于安装期间的install-config.yaml文件。

后续步骤
  • 配置您的集群以使用 oc-mirror 生成的资源。

故障排除

在完全断开连接的环境中镜像镜像集

要在完全断开连接的环境中镜像镜像集,必须首先将镜像集镜像到磁盘,然后将磁盘上的镜像集文件镜像到镜像

从镜像到磁盘的镜像

您可以使用 oc-mirror 插件生成镜像集并将内容保存到磁盘。然后可以将生成的镜像集传输到断开连接的环境并镜像到目标注册表。

根据镜像集配置文件中指定的配置,使用 oc-mirror 镜像镜像可能会将数百 GB 的数据下载到磁盘。

填充镜像注册表时的初始镜像集下载通常是最大的。因为您只下载自上次运行命令以来发生更改的镜像,所以再次运行 oc-mirror 插件时,生成的镜像集通常较小。

您需要在镜像集配置文件中指定一个存储后端。此存储后端可以是本地目录或 docker v2 注册表。oc-mirror 插件在创建镜像集期间将元数据存储在此存储后端中。

请勿删除或修改 oc-mirror 插件生成的元数据。每次对同一镜像注册表运行 oc-mirror 插件时,都必须使用相同的存储后端。

先决条件
  • 您可以访问互联网以获取必要的容器镜像。

  • 您已安装 OpenShift CLI (oc)。

  • 您已安装oc-mirror CLI 插件。

  • 您已创建镜像集配置文件。

步骤
  • 运行oc mirror命令将镜像从指定的镜像集配置镜像到磁盘。

    $ oc mirror --config=./imageset-config.yaml \(1)
      file://<path_to_output_directory>          (2)
    1 传入已创建的镜像集配置文件。此过程假设其名称为imageset-config.yaml
    2 指定您想要输出镜像集文件的目标目录。目标目录路径必须以file://开头。
验证
  1. 导航到您的输出目录

    $ cd <path_to_output_directory>
  2. 验证已创建镜像集.tar文件

    $ ls
    示例输出:
    mirror_seq1_000000.tar
后续步骤
  • 将镜像集 .tar 文件传输到断开连接的环境。

故障排除

从磁盘镜像到镜像

您可以使用 oc-mirror 插件将生成的镜像集内容镜像到目标镜像注册表。

先决条件
  • 您已在断开连接的环境中安装了 OpenShift CLI(oc)。

  • 您已在断开连接的环境中安装了oc-mirror CLI 插件。

  • 您已使用oc mirror命令生成了镜像集文件。

  • 您已将镜像集文件传输到断开连接的环境。

步骤
  • 运行oc mirror命令处理磁盘上的镜像集文件并将内容镜像到目标镜像注册表

    $ oc mirror --from=./mirror_seq1_000000.tar \(1)
      docker://registry.example:5000             (2)
    1 传入要镜像的镜像集 .tar 文件,本例中名为mirror_seq1_000000.tar。如果在镜像集配置文件中指定了archiveSize值,则镜像集可能会被分成多个 .tar 文件。在这种情况下,您可以传入包含镜像集 .tar 文件的目录。
    2 指定要将镜像集文件镜像到的注册表。注册表必须以docker://开头。如果为镜像注册表指定顶级命名空间,则必须在后续执行中也使用相同的命名空间。

    此命令使用镜像集更新镜像注册表,并生成ImageContentSourcePolicyCatalogSource资源。

验证
  1. 导航到生成的oc-mirror-workspace/目录。

  2. 导航到结果目录,例如results-1639608409/

  3. 验证ImageContentSourcePolicyCatalogSource资源是否存在 YAML 文件。

后续步骤
  • 配置您的集群以使用 oc-mirror 生成的资源。

故障排除

配置您的集群以使用 oc-mirror 生成的资源

将镜像集镜像到镜像注册表后,必须将生成的ImageContentSourcePolicyCatalogSource和发行版镜像签名资源应用到集群。

ImageContentSourcePolicy资源将镜像注册表与源注册表关联,并将来自在线注册表的镜像拉取请求重定向到镜像注册表。CatalogSource资源由 Operator Lifecycle Manager (OLM) 用于检索有关镜像注册表中可用 Operator 的信息。发行版镜像签名用于验证镜像的发行版镜像。

先决条件
  • 您已将镜像集镜像到断开连接环境中的注册表镜像。

  • 您可以作为具有cluster-admin角色的用户访问集群。

步骤
  1. 以具有cluster-admin角色的用户身份登录 OpenShift CLI。

  2. 通过运行以下命令将结果目录中的 YAML 文件应用到集群

    $ oc apply -f ./oc-mirror-workspace/results-1639608409/
  3. 如果镜像了发行版镜像,请通过运行以下命令将发行版镜像签名应用到集群

    $ oc apply -f ./oc-mirror-workspace/results-1639608409/release-signatures/

    如果您正在镜像 Operator 而不是集群,则不需要运行$ oc apply -f ./oc-mirror-workspace/results-1639608409/release-signatures/。运行该命令将返回错误,因为没有要应用的发行版镜像签名。

验证
  1. 通过运行以下命令验证ImageContentSourcePolicy资源是否已成功安装

    $ oc get imagecontentsourcepolicy
  2. 通过运行以下命令验证CatalogSource资源是否已成功安装

    $ oc get catalogsource -n openshift-marketplace

更新您的镜像注册表内容

您可以通过更新镜像集配置文件并将镜像集镜像到镜像注册表来更新您的镜像注册表内容。下次运行 oc-mirror 插件时,生成的镜像集将只包含自上次执行以来新的和更新的镜像。

更新镜像注册表时,必须考虑以下事项

  • 如果生成的最新镜像集中不再包含镜像,则会从目标镜像注册表中删除这些镜像。因此,请确保您正在更新以下关键组件的相同组合的镜像,以便只创建和镜像差异镜像集

    • 镜像集配置

    • 目标注册表

    • 存储配置

  • 在磁盘到镜像或镜像到镜像工作流程中,可以删除镜像。

  • 生成的镜像集必须按顺序推送到目标镜像注册表。您可以从生成的镜像集归档文件的名称中推导出序列号。

  • 不要删除或修改 oc-mirror 插件生成的元数据镜像。

  • 如果您在初始镜像集创建期间为镜像注册表指定了顶级命名空间,则每次对同一镜像注册表运行 oc-mirror 插件时都必须使用相同的命名空间。

有关更新镜像注册表内容工作流程的更多信息,请参阅“高级工作流程”部分。

镜像注册表更新示例

本节介绍从磁盘到镜像更新镜像注册表的用例。

先前用于镜像的示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
      - name: stable-4.12
        minVersion: 4.12.1
        maxVersion: 4.12.1
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
      packages:
        - name: rhacs-operator
          channels:
          - name: stable

通过删除现有镜像来镜像特定 OpenShift Container Platform 版本

更新的ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
      - name: stable-4.13 (1)
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
      packages:
        - name: rhacs-operator
          channels:
          - name: stable
1 stable-4.13替换将删除所有stable-4.12的镜像。

通过删除现有镜像来更新到 Operator 的最新版本

更新的ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
      - name: stable-4.12
        minVersion: 4.12.1
        maxVersion: 4.12.1
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
      packages:
        - name: rhacs-operator
          channels:
          - name: stable (1)
1 在不指定版本的情况下使用相同的通道将删除现有镜像并使用最新版本的镜像进行更新。

通过删除现有 Operator 来镜像新的 Operator

更新的ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
      - name: stable-4.12
        minVersion: 4.12.1
        maxVersion: 4.12.1
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
      packages:
        - name: <new_operator_name> (1)
          channels:
          - name: stable
1 new_operator_name替换rhacs-operator将删除 Red Hat Advanced Cluster Security for Kubernetes Operator。

删除所有 OpenShift Container Platform 镜像

更新的ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.14
      packages:

执行预演

您可以使用 oc-mirror 执行预演,而无需实际镜像任何镜像。这使您可以查看将要镜像的镜像列表以及将从镜像注册表中删除的任何镜像。预演还可以让您及早发现镜像集配置中的任何错误,或使用生成的镜像列表与其他工具一起执行镜像操作。

先决条件
  • 您可以访问互联网以获取必要的容器镜像。

  • 您已安装 OpenShift CLI (oc)。

  • 您已安装oc-mirror CLI 插件。

  • 您已创建镜像集配置文件。

步骤
  1. 使用--dry-run标志运行oc mirror命令以执行预演

    $ oc mirror --config=./imageset-config.yaml \(1)
      docker://registry.example:5000            \(2)
      --dry-run                                  (3)
    1 传入已创建的镜像集配置文件。此过程假设其名称为imageset-config.yaml
    2 指定镜像注册表。只要您使用--dry-run标志,就不会镜像任何内容到此注册表。
    3 使用--dry-run标志生成预演工件,而不是实际的镜像集文件。
    示例输出:
    Checking push permissions for registry.example:5000
    Creating directory: oc-mirror-workspace/src/publish
    Creating directory: oc-mirror-workspace/src/v2
    Creating directory: oc-mirror-workspace/src/charts
    Creating directory: oc-mirror-workspace/src/release-signatures
    No metadata detected, creating new workspace
    wrote mirroring manifests to oc-mirror-workspace/operators.1658342351/manifests-redhat-operator-index
    
    ...
    
    info: Planning completed in 31.48s
    info: Dry run complete
    Writing image mapping to oc-mirror-workspace/mapping.txt
  2. 导航到生成的 workspace 目录。

    $ cd oc-mirror-workspace/
  3. 查看生成的mapping.txt文件。

    此文件包含将要镜像的所有镜像的列表。

  4. 查看生成的pruning-plan.json文件。

    此文件包含发布镜像集时将从镜像注册表中删除的所有镜像的列表。

    只有当您的 oc-mirror 命令指向您的镜像注册表并且有要删除的镜像时,才会生成pruning-plan.json文件。

包含本地 OCI Operator 目录

将 OpenShift Container Platform 发行版、Operator 目录和附加镜像从注册表镜像到部分断开的集群时,您可以包含来自磁盘上基于文件的本地目录的 Operator 目录镜像。本地目录必须采用开放容器倡议 (OCI) 格式。

本地目录及其内容将根据镜像集配置文件中的过滤信息镜像到目标镜像注册表。

镜像本地 OCI 目录时,任何您想要与本地 OCI 格式目录一起镜像的 OpenShift Container Platform 版本或附加镜像都必须从注册表中拉取。

您不能将 OCI 目录与磁盘上的 oc-mirror 镜像集文件一起镜像。

使用 OCI 功能的一个示例用例是:如果您有一个 CI/CD 系统将 OCI 目录构建到磁盘上的某个位置,并且您想要将该 OCI 目录与 OpenShift Container Platform 版本一起镜像到您的镜像注册表。

如果您在 OpenShift Container Platform 4.12 中为 oc-mirror 插件使用了技术预览版 OCI 本地目录功能,则您将无法再使用 oc-mirror 插件的 OCI 本地目录功能来本地复制目录并将其转换为 OCI 格式,作为镜像到完全断开连接的集群的第一步。

先决条件
  • 您可以访问互联网以获取必要的容器镜像。

  • 您已安装 OpenShift CLI (oc)。

  • 您已安装oc-mirror CLI 插件。

步骤
  1. 创建镜像集配置文件并根据需要调整设置。

    以下示例镜像集配置文件将磁盘上的 OCI 目录与 OpenShift Container Platform 版本和来自 registry.redhat.io 的 UBI 镜像一起镜像。

    kind: ImageSetConfiguration
    apiVersion: mirror.openshift.io/v1alpha2
    storageConfig:
      local:
        path: /home/user/metadata                                                (1)
    mirror:
      platform:
        channels:
        - name: stable-4.17                                                      (2)
          type: ocp
        graph: false
      operators:
      - catalog: oci:///home/user/oc-mirror/my-oci-catalog                       (3)
        targetCatalog: my-namespace/redhat-operator-index                        (4)
        packages:
        - name: aws-load-balancer-operator
      - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17           (5)
        packages:
        - name: rhacs-operator
      additionalImages:
      - name: registry.redhat.io/ubi9/ubi:latest                                 (6)
    1 设置保存镜像集元数据的后端位置。此位置可以是注册表或本地目录。必须指定storageConfig值。
    2 可选地,包含要从 registry.redhat.io 镜像的 OpenShift Container Platform 版本。
    3 指定磁盘上 OCI 目录位置的绝对路径。使用 OCI 功能时,路径必须以 oci:// 开头。
    4 可选地,指定一个备用命名空间和名称来镜像目录。
    5 可选地,指定要从注册表中拉取的其他 Operator 目录。
    6 可选地,指定要从注册表中拉取的其他镜像。
  2. 运行 oc mirror 命令将 OCI 目录镜像到目标镜像注册表。

    $ oc mirror --config=./imageset-config.yaml \ (1)
      docker://registry.example:5000              (2)
    
    1 传入镜像集配置文件。此过程假设其名为 imageset-config.yaml
    2 指定要将内容镜像到的注册表。注册表必须以 docker:// 开头。如果您为镜像注册表指定了顶级命名空间,则必须在后续执行中也使用相同的命名空间。

    可选地,您可以指定其他标志来调整 OCI 功能的行为。

    --oci-insecure-signature-policy

    不要将签名推送到目标镜像注册表。

    --oci-registries-config

    指定 TOML 格式的 registries.conf 文件的路径。您可以使用它从不同的注册表(例如用于测试的预生产位置)镜像,而无需更改镜像集配置文件。此标志仅影响本地 OCI 目录,不影响任何其他镜像内容。

    registries.conf 文件示例
    [[registry]]
     location = "registry.redhat.io:5000"
     insecure = false
     blocked = false
     mirror-by-digest-only = true
     prefix = ""
     [[registry.mirror]]
        location = "preprod-registry.example.com"
        insecure = false
后续步骤
  • 配置您的集群以使用 oc-mirror 生成的资源。

镜像集配置文件参数

oc-mirror 插件需要一个镜像集配置文件来定义要镜像哪些镜像。下表列出了 ImageSetConfiguration 资源的可用参数。

表 1. ImageSetConfiguration 参数
参数 描述

apiVersion

ImageSetConfiguration 内容的 API 版本。

字符串。例如:mirror.openshift.io/v1alpha2

archiveSize

镜像集中每个归档文件的最大大小(以 GiB 为单位)。

整数。例如:4

mirror

镜像集的配置。

对象

mirror.additionalImages

镜像集的附加镜像配置。

对象的数组。例如

additionalImages:
  - name: registry.redhat.io/ubi8/ubi:latest

mirror.additionalImages.name

要镜像的镜像的标签或摘要。

字符串。例如:registry.redhat.io/ubi8/ubi:latest

mirror.blockedImages

要阻止镜像的镜像的完整标签、摘要或模式。

字符串数组。例如:docker.io/library/alpine

mirror.helm

镜像集的 helm 配置。请注意,oc-mirror 插件仅支持在渲染时不需要用户输入的 helm chart。

对象

mirror.helm.local

要镜像的本地 helm chart。

对象的数组。例如

local:
  - name: podinfo
    path: /test/podinfo-5.0.0.tar.gz

mirror.helm.local.name

要镜像的本地 helm chart 的名称。

字符串。例如:podinfo

mirror.helm.local.path

要镜像的本地 helm chart 的路径。

字符串。例如:/test/podinfo-5.0.0.tar.gz

mirror.helm.repositories

要从中镜像的远程 helm 仓库。

对象的数组。例如

repositories:
  - name: podinfo
    url: https://example.github.io/podinfo
    charts:
      - name: podinfo
        version: 5.0.0

mirror.helm.repositories.name

要从中镜像的 helm 仓库的名称。

字符串。例如:podinfo

mirror.helm.repositories.url

要从中镜像的 helm 仓库的 URL。

字符串。例如:https://example.github.io/podinfo

mirror.helm.repositories.charts

要镜像的远程 helm chart。

对象的数组。

mirror.helm.repositories.charts.name

要镜像的 helm chart 的名称。

字符串。例如:podinfo

mirror.helm.repositories.charts.version

要镜像的命名 helm chart 的版本。

字符串。例如:5.0.0

mirror.operators

镜像集的 Operators 配置。

对象的数组。例如

operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
    packages:
      - name: elasticsearch-operator
        minVersion: '2.4.0'

mirror.operators.catalog

要包含在镜像集中的 Operator 目录。

字符串。例如:registry.redhat.io/redhat/redhat-operator-index:v4.17

mirror.operators.full

当为 true 时,下载完整的目录、Operator 包或 Operator 通道。

布尔值。默认值为 false

mirror.operators.packages

Operator 包配置。

对象的数组。例如

operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
    packages:
      - name: elasticsearch-operator
        minVersion: '5.2.3-31'

mirror.operators.packages.name

要包含在镜像集中的 Operator 包名称。

字符串。例如:elasticsearch-operator

mirror.operators.packages.channels

Operator 包通道配置。

对象

mirror.operators.packages.channels.name

要包含在镜像集中的 Operator 通道名称,在包内唯一。

字符串。例如:faststable-v4.17

mirror.operators.packages.channels.maxVersion

在 Operator 存在的所有通道中镜像的最高版本。有关更多信息,请参阅以下说明。

字符串。例如:5.2.3-31

mirror.operators.packages.channels.minBundle

要包含的最小 bundle 的名称,以及更新图中到通道头的所有 bundle。仅当命名 bundle 没有语义版本元数据时才设置此字段。

字符串。例如:bundleName

mirror.operators.packages.channels.minVersion

在 Operator 存在的所有通道中镜像的最低版本。有关更多信息,请参阅以下说明。

字符串。例如:5.2.3-31

mirror.operators.packages.maxVersion

在 Operator 存在的所有通道中镜像的最高版本。有关更多信息,请参阅以下说明。

字符串。例如:5.2.3-31

mirror.operators.packages.minVersion

在 Operator 存在的所有通道中镜像的最低版本。有关更多信息,请参阅以下说明。

字符串。例如:5.2.3-31

mirror.operators.skipDependencies

如果为 true,则不包含 bundle 的依赖项。

布尔值。默认值为 false

mirror.operators.targetCatalog

要镜像引用的目录的替代名称和可选命名空间层次结构。

字符串。例如:my-namespace/my-operator-catalog

mirror.operators.targetName

要镜像引用的目录的替代名称。

targetName 参数已弃用。请改用 targetCatalog 参数。

字符串。例如:my-operator-catalog

mirror.operators.targetTag

附加到targetNametargetCatalog的备用标签。

字符串。例如:v1

mirror.platform

镜像集的平台配置。

对象

mirror.platform.architectures

要镜像的平台发布负载的架构。

字符串数组。例如

architectures:
  - amd64
  - arm64
  - multi
  - ppc64le
  - s390x

默认值为amd64。值multi确保镜像支持所有可用架构,无需指定单个架构。

mirror.platform.channels

镜像集的平台通道配置。

对象的数组。例如

channels:
  - name: stable-4.10
  - name: stable-4.17

mirror.platform.channels.full

设置为true时,将minVersion设置为通道中的第一个版本,并将maxVersion设置为通道中的最后一个版本。

布尔值。默认值为 false

mirror.platform.channels.name

发行通道的名称。

字符串。例如:stable-4.17

mirror.platform.channels.minVersion

要镜像的参考平台的最小版本。

字符串。例如:4.12.6

mirror.platform.channels.maxVersion

要镜像的参考平台的最高版本。

字符串。例如:4.17.1

mirror.platform.channels.shortestPath

切换最短路径镜像或全范围镜像。

布尔值。默认值为 false

mirror.platform.channels.type

要镜像的平台类型。

字符串。例如:ocpokd。默认为ocp

mirror.platform.graph

指示是否将OSUS图添加到镜像集并随后发布到镜像。

布尔值。默认值为 false

storageConfig

镜像集的后端配置。

对象

storageConfig.local

镜像集的本地后端配置。

对象

storageConfig.local.path

包含镜像集元数据的目录路径。

字符串。例如:./path/to/dir/

storageConfig.registry

镜像集的注册表后端配置。

对象

storageConfig.registry.imageURL

后端注册表URI。可以选择在URI中包含命名空间引用。

字符串。例如:quay.io/myuser/imageset:metadata

storageConfig.registry.skipTLS

可以选择跳过对引用的后端注册表的TLS验证。

布尔值。默认值为 false

使用minVersionmaxVersion属性过滤特定Operator版本范围可能会导致多个通道头错误。错误消息指出存在多个通道头。这是因为应用过滤器时,Operator的更新图被截断。

Operator生命周期管理器要求每个Operator通道包含形成具有恰好一个端点的更新图的版本,即Operator的最新版本。应用过滤器范围后,该图可能会变成两个或多个单独的图,或者具有多个端点的图。

为避免此错误,请勿过滤掉Operator的最新版本。如果仍然遇到此错误,则根据Operator的不同,必须增加maxVersion属性或减小minVersion属性。因为每个Operator图可能不同,您可能需要调整这些值直到错误解决。

镜像集配置示例

以下ImageSetConfiguration文件示例显示了各种镜像用例的配置。

用例:包含最短的OpenShift Container Platform更新路径

以下ImageSetConfiguration文件使用本地存储后端,并包含从最小版本4.11.37到最大版本4.12.15的最短更新路径上的所有OpenShift Container Platform版本。

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  platform:
    channels:
      - name: stable-4.12
        minVersion: 4.11.37
        maxVersion: 4.12.15
        shortestPath: true

用例:包含从最小版本到最新版本的多架构版本的OpenShift Container Platform的所有版本

以下ImageSetConfiguration文件使用注册表存储后端,并包含从最小版本4.13.4开始到通道中最新版本的OpenShift Container Platform的所有版本。每次使用此镜像集配置调用oc-mirror时,都会评估stable-4.13通道的最新版本,因此定期运行oc-mirror可确保您自动接收OpenShift Container Platform镜像的最新版本。

通过将platform.architectures的值设置为multi,您可以确保镜像支持多架构版本。

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  platform:
    architectures:
      - "multi"
    channels:
      - name: stable-4.13
        minVersion: 4.13.4
        maxVersion: 4.13.6

用例:包含从最小版本到最新版本的Operator版本

以下ImageSetConfiguration文件使用本地存储后端,仅包含Red Hat Advanced Cluster Security for Kubernetes Operator,版本从4.0.1开始,以及stable通道中的更高版本。

指定最小或最大版本范围时,您可能无法接收该范围内的所有Operator版本。

默认情况下,oc-mirror会排除在Operator生命周期管理器(OLM)规范中被跳过或被更新版本替换的任何版本。被跳过的Operator版本可能会受到CVE的影响或包含错误。请改用更新的版本。有关跳过和替换版本的更多信息,请参阅使用OLM创建更新图

要接收指定范围内的所有Operator版本,可以将mirror.operators.full字段设置为true

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  local:
    path: /home/user/metadata
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
      packages:
        - name: rhacs-operator
          channels:
          - name: stable
            minVersion: 4.0.1

要指定最大版本而不是最新版本,请设置mirror.operators.packages.channels.maxVersion字段。

用例:包含Nutanix CSI Operator

以下ImageSetConfiguration文件使用本地存储后端,并包含Nutanix CSI Operator、OpenShift Update Service (OSUS)图镜像和一个额外的Red Hat通用基础镜像(UBI)。

示例ImageSetConfiguration文件
kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
storageConfig:
  registry:
    imageURL: mylocalregistry/ocp-mirror/openshift4
    skipTLS: false
mirror:
  platform:
    channels:
    - name: stable-4.11
      type: ocp
    graph: true
  operators:
  - catalog: registry.redhat.io/redhat/certified-operator-index:v4.17
    packages:
    - name: nutanixcsioperator
      channels:
      - name: stable
  additionalImages:
  - name: registry.redhat.io/ubi9/ubi:latest

用例:包含默认Operator通道

以下ImageSetConfiguration文件包含OpenShift Elasticsearch Operator的stable-5.7stable通道。即使只需要stable-5.7通道中的包,也必须在ImageSetConfiguration文件中包含stable通道,因为它是的默认通道。即使您不使用该通道中的包,也必须始终包含Operator包的默认通道。

您可以通过运行以下命令找到默认通道:oc mirror list operators --catalog=<catalog_name> --package=<package_name>

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
    packages:
    - name: elasticsearch-operator
      channels:
      - name: stable-5.7
      - name: stable

用例:包含整个目录(所有版本)

以下ImageSetConfiguration文件将mirror.operators.full字段设置为true以包含整个Operator目录的所有版本。

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
      full: true

用例:包含整个目录(仅通道头)

以下ImageSetConfiguration文件包含整个Operator目录的通道头。

默认情况下,对于目录中的每个Operator,oc-mirror都包含来自默认通道的最新Operator版本(通道头)。如果要镜像所有Operator版本,而不仅仅是通道头,则必须将mirror.operators.full字段设置为true

此示例还使用targetCatalog字段指定一个备用命名空间和名称来镜像目录。

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
    targetCatalog: my-namespace/my-operator-catalog

用例:包含任意镜像和helm图表

以下ImageSetConfiguration文件使用注册表存储后端,并包含helm图表和一个额外的Red Hat通用基础镜像(UBI)。

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
archiveSize: 4
storageConfig:
  registry:
    imageURL: example.com/mirror/oc-mirror-metadata
    skipTLS: false
mirror:
 platform:
   architectures:
     - "s390x"
   channels:
     - name: stable-4.17
 operators:
   - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
 helm:
   repositories:
     - name: redhat-helm-charts
       url: https://raw.githubusercontent.com/redhat-developer/redhat-helm-charts/master
       charts:
         - name: ibm-mongodb-enterprise-helm
           version: 0.2.0
 additionalImages:
   - name: registry.redhat.io/ubi9/ubi:latest

用例:包含EUS版本的升级路径

以下ImageSetConfiguration文件包含eus-<version>通道,其中maxVersion值至少比minVersion值高两个次要版本。

例如,在此ImageSetConfiguration文件中,minVersion设置为4.12.28,而eus-4.14通道的maxVersion4.14.16

示例ImageSetConfiguration文件
kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v2alpha1
mirror:
  platform:
    graph: true # Required for the OSUS Operator
    architectures:
    - amd64
    channels:
    - name: stable-4.12
      minVersion: '4.12.28'
      maxVersion: '4.12.28'
      shortestPath: true
      type: ocp
    - name: eus-4.14
      minVersion: '4.12.28'
      maxVersion: '4.14.16'
      shortestPath: true
      type: ocp

用例:包含多架构 OpenShift Container Platform 镜像和用于多集群引擎 Operator 的目录

下面的ImageSetConfiguration文件包含 Kubernetes Operator 的多集群引擎,以及从4.17.0版本开始的所有 OpenShift Container Platform 版本。

示例ImageSetConfiguration文件
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  registry:
    imageURL: agent.agent.example.com:5000/openshift/release/metadata:latest/openshift/release/metadata:latest
mirror:
  platform:
    architectures:
      - "multi"
    channels:
    - name: stable-4.17
      minVersion: 4.17.0
      maxVersion: 4.17.1
      type: ocp
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
      packages:
        - name: multicluster-engine

oc-mirror 命令参考

下表描述了oc mirror 的子命令和标志。

表 2. oc mirror 子命令
子命令 描述

completion

生成指定 shell 的自动补全脚本。

describe

输出镜像集的内容。

help

显示任何子命令的帮助信息。

init

输出初始镜像集配置模板。

list

列出可用的平台和 Operator 内容及其版本。

version

输出 oc-mirror 版本。

表 3. oc mirror 标志
标志 描述

-c, --config <string>

指定镜像集配置文件的路径。

--continue-on-error

如果发生任何与镜像拉取无关的错误,则继续并尝试镜像尽可能多的内容。

--dest-skip-tls

禁用目标注册表的 TLS 验证。

--dest-use-http

对目标注册表使用纯 HTTP。

--dry-run

打印操作而无需镜像镜像。生成mapping.txtpruning-plan.json文件。

--from <string>

指定 oc-mirror 执行生成的镜像集存档的路径,以加载到目标注册表中。

-h, --help

显示帮助信息。

--ignore-history

下载镜像和打包层时忽略过去的镜像。禁用增量镜像,可能会下载更多数据。

--manifests-only

生成ImageContentSourcePolicy对象的清单,以配置集群使用镜像注册表,但不实际镜像任何镜像。要使用此标志,必须使用--from标志传入镜像集存档。

--max-nested-paths <int>

指定限制嵌套路径的目标注册表的嵌套路径的最大数量。默认为0

--max-per-registry <int>

指定每个注册表允许的并发请求数。默认为6

--oci-insecure-signature-policy

镜像本地 OCI 目录时(使用--include-local-oci-catalogs),不要推送签名。

--oci-registries-config

提供注册表配置文件,以指定镜像本地 OCI 目录时(使用--include-local-oci-catalogs)要从中复制的替代注册表位置。

--skip-cleanup

跳过删除构件目录。

--skip-image-pin

不要将镜像标签替换为 Operator 目录中的摘要固定值。

--skip-metadata-check

发布镜像集时跳过元数据检查。仅当使用--ignore-history创建镜像集时才推荐此方法。

--skip-missing

如果找不到镜像,则跳过它,而不是报告错误并中止执行。不适用于镜像集配置中明确指定的自定义镜像。

--skip-pruning

禁用从目标镜像注册表自动修剪镜像。

--skip-verification

跳过摘要验证。

--source-skip-tls

禁用源注册表的 TLS 验证。

--source-use-http

对源注册表使用纯 HTTP。

-v, --verbose <int>

指定日志级别详细程度的数字。有效值为0 - 9。默认为0