3.3. 填充私有自动化中(automation hub)容器 registry
默认情况下,私有自动化中心不包括容器镜像。要填充容器 registry,您需要将容器镜像推送到其中。
您必须遵循特定的工作流来填充私有自动化中心容器 registry:
- 从红帽生态系统目录 (registry.redhat.io) 中拉取镜像
- 标记它们
- 将它们推送到您的私有自动化中心容器 registry
从 2025 年 4 月 1 日起, quay.io 正在添加三个额外的端点。因此,客户必须调整防火墙系统列表中的允许/块列表,使其包含以下端点:
-
cdn04.quay.io -
cdn05.quay.io -
cdn06.quay.io
为了避免拉取容器镜像出现问题,客户必须将出站 TCP 连接(端口 80 和 443)到以下主机名:
-
cdn.quay.io -
cdn01.quay.io -
cdn02.quay.io -
cdn03.quay.io -
cdn04.quay.io -
cdn05.quay.io -
cdn06.quay.io
此更改应针对用于启用到 registry.redhat.io 或 registry.access.redhat.com 的出站连接的任何防火墙配置进行修改。
在配置防火墙规则时使用主机名而不是 IP 地址。
完成此更改后,您可以继续从 registry.redhat.io 或 registry.access.redhat.com 拉取镜像。您不需要 quay.io 登录,或以任何方式直接与 quay.io registry 交互,以继续拉取红帽容器镜像。
如需更多信息,请参阅容器镜像防火墙更改 2024/2025。
确保 Table 6.4 中列出的 网络端口和协议。执行环境(EE) 可用于避免拉取容器镜像的问题。
3.3.1. 拉取 (pull) 用于自动化中心的镜像 复制链接链接已复制到粘贴板!
在将容器镜像推送到私有自动化中心之前,您必须首先从现有 registry 中拉取容器镜像并标记它们以供使用。以下示例详细介绍了如何从红帽生态系统目录 (registry.redhat.io) 拉取镜像。
前提条件
- 有从 registry.redhat.io 拉取镜像的权限
流程
使用您的 registry.redhat.io 凭证登录到 Podman:
podman login registry.redhat.io
$ podman login registry.redhat.ioCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 输入您的用户名和密码。
拉取容器镜像:
podman pull registry.redhat.io/<container_image_name>:<tag>
$ podman pull registry.redhat.io/<container_image_name>:<tag>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
要验证您最近拉取的镜像是否包含在列表中,请执行以下步骤:
列出本地存储中的镜像:
podman images
$ podman imagesCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 检查镜像名称,并验证标签是否正确。
3.3.2. 用于自动化中心的标记镜像 复制链接链接已复制到粘贴板!
从 registry 中拉取镜像后,标记它们以便在私有自动化中心容器 registry 中使用。
前提条件
- 您已从外部 registry 中提取容器镜像。
- 有自动化中心实例的 FQDN 或 IP 地址。
流程
使用自动化中心容器存储库标记本地镜像:
podman tag registry.redhat.io/<container_image_name>:<tag> <automation_hub_hostname>/<container_image_name>
$ podman tag registry.redhat.io/<container_image_name>:<tag> <automation_hub_hostname>/<container_image_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
验证
列出本地存储中的镜像:
podman images
$ podman imagesCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 验证您最近使用自动化中心信息标记的镜像是否包含在列表中。
3.3.3. 将容器镜像推送到私有自动化中心 复制链接链接已复制到粘贴板!
您可以将标记的容器镜像推送到私有自动化中心,以创建新容器并填充容器 registry。
前提条件
- 有创建新容器的权限。
- 有自动化中心实例的 FQDN 或 IP 地址。
流程
使用您的自动化中心位置和凭证登录到 Podman:
podman login -u=<username> -p=<password> <automation_hub_url>
$ podman login -u=<username> -p=<password> <automation_hub_url>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将容器镜像推送到自动化中心容器 registry:
podman push <automation_hub_url>/<container_image_name>
$ podman push <automation_hub_url>/<container_image_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
故障排除
push 操作会在上传期间重新编译镜像层,无法保证可重复生成,依赖于客户端实施。这可能会导致镜像层摘要的变化,并导致推送操作失败,Error: Copying this image requires changing layer representation, which is not possible (image is signed or the destination specifies a digest)。
验证
- 登录到您的自动化中心。
- 进入 。
- 在 container 存储库列表中找到容器。