配置文件路径 /etc/containers/registries.conf
Podman 3.0.0+版本配置文件格式发生了变化,最显著的是现在默认会有一条 unqualified-search-registries = ["docker.io", "quay.io"]
按照如下格式添加镜像:
[[registry]]
prefix = "192.168.0.1:7000"
location = "192.168.0.1:7000"
insecure = true
其中prefix是pull的时候指定的镜像前缀,location是获取镜像的地址,如果不指定prefix则默认和location一致。insecure=true表示允许通过HTTP协议来获取镜像,对于私有化部署/内网测试环境下无https证书的环境来说很有帮助。
如果配置错误可能会出现以下错误提示:
Error: error getting default registries to try: error loading registries configuration "/etc/containers/registries.conf": toml: cannot load TOML value of type map[string]interface {} into a Go slice
Error: error getting default registries to try: error loading registries configuration "/etc/containers/registries.conf": toml: cannot load TOML value of type []map[string]interface {} into a Go boolean
Podman 3.0之前配置文件格式如下:
[registries.search]
registries = ['docker.io']
[registries.insecure]
registries = ['192.168.0.1:7000']
其中registries.search与新版unqualified-search-registries含义相同,registries.insecure表示这些registry允许不安全的HTTP拉取
Podman3.0.0版本后,其配置文件registries.conf的格式有所调整,新增了unqualified-search-registries字段。现在需要按照新的格式添加私有镜像,例如[[registry]]结构。错误配置可能导致无法加载TOML文件。旧版配置中的registries.search和registries.insecure分别对应新版的unqualified-search-registries和insecure字段。正确配置能确保在没有HTTPS证书的内网环境中安全地拉取镜像。
1876

被折叠的 条评论
为什么被折叠?



