docker 清单平台变体的有效值是什么



https://docs.docker.com/registry/spec/manifest-v2-2/的模式规范没有这么说。

可以在

https://github.com/docker-library/official-images#architectures-other-than-amd64 的 docker 存储库中找到体系结构列表。但是,查看一些流行的图像会显示不同的输出,例如

docker manifest inspect alpine
...
  {
     "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
     "size": 528,
     "digest": "sha256:c4ba6347b0e4258ce6a6de2401619316f982b7bcc529f73d2a410d0097730204",
     "platform": {
        "architecture": "arm",
        "os": "linux",
        "variant": "v6"
     }
  },
  {
     "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
     "size": 528,
     "digest": "sha256:7b7521cf1e23b0e1756c68a946b255d0619266767b7d62bf7fe7c8618e0a9a17",
     "platform": {
        "architecture": "arm",
        "os": "linux",
        "variant": "v7"
     }
  },
...

那么,指定 ARM 架构等平台变体的正确方法是什么?

似乎这至少可以通过查看 docker cli 源代码来部分回答 https://github.com/docker/cli/blob/1f6a1a438c4ae426e446f17848114e58072af2bb/cli/command/manifest/util.go。以下是操作系统/架构选项的列表,但不是架构变体:

var validOSArches = map[osArch]bool{
    {os: "darwin", arch: "386"}:      true,
    {os: "darwin", arch: "amd64"}:    true,
    {os: "darwin", arch: "arm"}:      true,
    {os: "darwin", arch: "arm64"}:    true,
    {os: "dragonfly", arch: "amd64"}: true,
    {os: "freebsd", arch: "386"}:     true,
    {os: "freebsd", arch: "amd64"}:   true,
    {os: "freebsd", arch: "arm"}:     true,
    {os: "linux", arch: "386"}:       true,
    {os: "linux", arch: "amd64"}:     true,
    {os: "linux", arch: "arm"}:       true,
    {os: "linux", arch: "arm64"}:     true,
    {os: "linux", arch: "ppc64le"}:   true,
    {os: "linux", arch: "mips64"}:    true,
    {os: "linux", arch: "mips64le"}:  true,
    {os: "linux", arch: "s390x"}:     true,
    {os: "netbsd", arch: "386"}:      true,
    {os: "netbsd", arch: "amd64"}:    true,
    {os: "netbsd", arch: "arm"}:      true,
    {os: "openbsd", arch: "386"}:     true,
    {os: "openbsd", arch: "amd64"}:   true,
    {os: "openbsd", arch: "arm"}:     true,
    {os: "plan9", arch: "386"}:       true,
    {os: "plan9", arch: "amd64"}:     true,
    {os: "solaris", arch: "amd64"}:   true,
    {os: "windows", arch: "386"}:     true,
    {os: "windows", arch: "amd64"}:   true,

最新更新