Docker清单平台变体的有效值是多少

时间:2019-04-27 15:50:52

标签: docker arm

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

可以在https://github.com/docker-library/official-images#architectures-other-than-amd64的docker repos中找到体系结构列表。但是,查看一些受欢迎的图像会显示不同的输出,例如

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体系结构之类的平台变体的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

似乎可以通过查看https://github.com/docker/cli/blob/1f6a1a438c4ae426e446f17848114e58072af2bb/cli/command/manifest/util.go上的docker cli源来至少部分地解决此问题。这是os / architecture选项的列表,虽然不是体系结构的变体:

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,