3.7. 从私有 registry 获取容器镜像


有些容器镜像 registry 可能需要进行身份验证才能访问镜像。在这种情况下,请使用您的 containers-prepare-parameter.yaml 环境文件中的 ContainerImageRegistryCredentials 参数。

parameter_defaults:
  ContainerImagePrepare:
  - (strategy one)
  - (strategy two)
  - (strategy three)
  ContainerImageRegistryCredentials:
    registry.example.com:
      username: "p@55w0rd!"
重要

私有 registry 需要针对其在 ContainerImagePrepare 中的相应策略将 push_destination 设置为 true

ContainerImageRegistryCredentials 参数使用一组基于私有 registry URL 的键。每个私有 registry URL 使用其自己的键和值对定义用户名(键)和密码(值)。这提供了一种为多个私有 registry 指定凭据的方法。

parameter_defaults:
  ...
  ContainerImageRegistryCredentials:
    registry.redhat.io:
      myuser: 'p@55w0rd!'
    registry.internalsite.com:
      myuser2: '0th3rp@55w0rd!'
    '192.0.2.1:8787':
      myuser3: '@n0th3rp@55w0rd!'
重要

默认 ContainerImagePrepare 参数从需要进行身份验证的 registry.redhat.io 中拉取容器镜像。

ContainerImageRegistryLogin 参数用于控制系统是否需要登录到远程 registry 来获取容器。

parameter_defaults:
  ...
  ContainerImageRegistryLogin: true
重要

如果给定策略没有配置 push_destination,则必须将其设置为 true。如果在 ContainerImagePrepare 策略中配置 push_destination,并且配置了ContainerImageRegistryCredentials 参数,则系统将登录以获取容器并将其推送到远程系统。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.