你也许会好奇,在 Apple M2 芯片的主机设备上运行 amd64 平台镜像会怎样。目前咱们构建的这个简单镜像其实是能够运行的,只不过会得到一条警告信息:
1 2 3
$ docker run --rm jianghushinian/echo-platform-amd64 WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested Linux buildkitsandbox 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 x86_64 Linux
# docker run --rm jianghushinian/echo-platform-arm64 WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested Linux buildkitsandbox 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 aarch64 Linux
在 amd64 架构的设备上运行 amd64 平台镜像则不会遇到警告问题:
1 2
# docker run --rm jianghushinian/echo-platform-amd64 Linux buildkitsandbox 5.15.49-linuxkit #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 x86_64 Linux
The **docker manifest** command has subcommands for managing image manifests and manifest lists. A manifest list allows you to use one name to refer to the same image built for multiple architectures.
To see helpfor a subcommand, use:
docker manifest CMD --help
For full details on using docker manifest lists, see the registry v2 specification.
EXPERIMENTAL: docker manifest is an experimental feature. Experimental features provide early access to product functionality. These features may change between releases without warning, or can be removed from a future release. Learn more about experimental features in our documentation: https://docs.docker.com/go/experimental/
Commands: annotate Add additional information to a local image manifest create Create a local manifest list for annotating and pushing to a registry inspect Display an image manifest, or manifest list push Push a manifest list to a repository rm Delete one or more manifest lists from local storage
Run 'docker manifest COMMAND --help'for more information on a command.
Create a local manifest list for annotating and pushing to a registry
EXPERIMENTAL: docker manifest create is an experimental feature. Experimental features provide early access to product functionality. These features may change between releases without warning, or can be removed from a future release. Learn more about experimental features in our documentation: https://docs.docker.com/go/experimental/
Options: -a, --amend Amend an existing manifest list --insecure Allow communication with an insecure registry
EXPERIMENTAL: docker manifest push is an experimental feature. Experimental features provide early access to product functionality. These features may change between releases without warning, or can be removed from a future release. Learn more about experimental features in our documentation: https://docs.docker.com/go/experimental/
Options: --insecure Allow push to an insecure registry -p, --purge Remove the local manifest list after push
同样的,push 也有一个 --insecure 参数允许使用不安全的(非 https)镜像仓库。
-p/--purge 选项的作用是推送本地镜像到远程仓库后,删除本地 manifest list。
inspect
inspect 用来查看 manifest/manifest list 所包含的镜像信息。
其使用帮助如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
$ docker manifest inspect -h Flag shorthand -h has been deprecated, please use --help
EXPERIMENTAL: docker manifest inspect is an experimental feature. Experimental features provide early access to product functionality. These features may change between releases without warning, or can be removed from a future release. Learn more about experimental features in our documentation: https://docs.docker.com/go/experimental/
Options: --insecure Allow communication with an insecure registry -v, --verbose Output additional info including layers and platform
Add additional information to a local image manifest
EXPERIMENTAL: docker manifest annotate is an experimental feature. Experimental features provide early access to product functionality. These features may change between releases without warning, or can be removed from a future release. Learn more about experimental features in our documentation: https://docs.docker.com/go/experimental/
Options: --arch string Set architecture --os string Set operating system --os-features strings Set operating system feature --os-version string Set operating system version --variant string Set architecture variant
可选参数列表如下:
选项
描述
–arch
设置 CPU 架构信息。
–os
设置操作系统信息。
–os-features
设置操作系统功能信息。
–os-version
设置操作系统版本信息。
–variant
设置 CPU 架构的 variant 信息(翻译过来是“变种”的意思),如 ARM 架构的 v7、v8 等。
Delete one or more manifest lists from local storage
EXPERIMENTAL: docker manifest rm is an experimental feature. Experimental features provide early access to product functionality. These features may change between releases without warning, or can be removed from a future release. Learn more about experimental features in our documentation: https://docs.docker.com/go/experimental/