7.3. 管理容器 registry
您可以将 OpenShift Container Platform 配置为使用外部 docker registry 来拉取镜像。但是,您可以使用配置文件来允许或拒绝某些镜像或 registry。
如果外部 Registry 使用了证书用于网络流量,它可以将其称为安全 registry。否则,registry 和 host 之间的流量是纯文本而不是加密,这意味着它是一个不安全的 registry。
7.3.1. Docker 搜索外部 registry 复制链接链接已复制到粘贴板!
默认情况下,docker 守护进程能够从任何 registry 中拉取镜像,但搜索操作针对 docker.io/ 和 registry.redhat.io 执行。守护进程可以配置为通过 docker 守护进程使用 --add-registry 选项从其他 registry 中搜索镜像。
Red Hat Enterprise Linux docker 软件包中默认存在从 Red Hat Registry registry.redhat.io 搜索镜像的功能。
流程
要允许用户在其他 registry 中使用
docker search搜索镜像,请将这些 registry 添加到registry参数下的/etc/containers/registries.conf文件中:registries: - registry.redhat.io - my.registry.example.com
registries: - registry.redhat.io - my.registry.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow 重启
docker守护进程以允许使用my.registry.example.com:sudo systemctl restart docker.service
$ sudo systemctl restart docker.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow 重启
docker守护进程会导致docker容器重启。使用 Ansible 安装程序,这可以使用 Ansible 主机文件中的
openshift_docker_additional_registries变量进行配置:openshift_docker_additional_registries=registry.redhat.io,my.registry.example.com
openshift_docker_additional_registries=registry.redhat.io,my.registry.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow