Podman

Podman:無法載入類型 map 的 TOML 值

  • August 25, 2021

我需要為 podman 獲取此圖像,但registry.conf有問題

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

怎麼了

您要定義的是一個數組,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]]代替[registry],這將在 YAML 等效文件-的前面添加一個,並在 JSON 等效中包含的對象周圍添加一個數組結構。mirror``[...]``mirror

引用自:https://unix.stackexchange.com/questions/655135