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
参数,则系统将登录以获取容器并将其推送到远程系统。