Podman:无法加载映射类型的 TOML 值

Podman:无法加载映射类型的 TOML 值

我需要获取这个图像对于 podman 但有问题注册表文件

podman 给出错误

podman run --name myfirstcontainer -it  -v /home/jhon:/data:Z manjarolinux/base
Error: error loading registries configuration "/etc/containers/registries.conf": toml: cannot load TOML value of type map[string]interface {} into a Go slice

我的注册表调整

# [[registry.mirror]]
# location = "example-mirror-0.local/mirror-for-foo"
# [[registry.mirror]]
# location = "example-mirror-1.local/mirrors/foo"
# insecure = true
# # Given the above, a pull of example.com/foo/image:latest will try:
# # 1. example-mirror-0.local/mirror-for-foo/image:latest
# # 2. example-mirror-1.local/mirrors/foo/image:latest
# # 3. internal-registry-for-example.net/bar/image:latest
# # in order, and use the first one that exists.
#
[[registry.mirror]]
prefix ="docker.io"
location = "https://hub.docker.com/r/manjarolinux/base"
insecure =true

怎么了

答案1

您试图定义的是一个mirror属于顶级 key 的数组registry,但不清楚是registry保存单个对象还是对象数组。

要用作registry单个对象,

[registry]
[[registry.mirror]]
prefix = "docker.io"
location = "https://hub.docker.com/r/manjarolinux/base"
insecure = true

这对应于YAML文档

registry:
  mirror:
    - prefix: docker.io
      location: https://hub.docker.com/r/manjarolinux/base
      insecure: true

或 JSON 文档

{
  "registry": {
    "mirror": [
      {
        "prefix": "docker.io",
        "location": "https://hub.docker.com/r/manjarolinux/base",
        "insecure": true
      }
    ]
  }
}

如果registry应该是大批(这似乎更有可能),然后使用[[registry]]in 代替[registry],这会在 YAML 等效文档-前面添加 a ,并在包含 JSON 等效文档的对象周围添加一个数组结构。mirror[...]mirror

相关内容