1. docker manifest annotate
1.1. 说明
给一个本地的镜像 manifest 添加额外的信息。
创建多架构镜像的本地镜像后,可以选择对其进行注释。 允许的注释的内容包括体系结构和操作系统(如果已经有值,会覆盖镜像的当前值),操作系统功能以及体系结构变体。
1.2. 帮助
# docker manifest annotate --help
Usage: docker manifest annotate [OPTIONS] MANIFEST_LIST MANIFEST
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
1.3. 选项
名称,简写 | 默认值 | 描述 |
---|---|---|
--arch | - | 设置 CPU 架构信息 |
--os | - | 设置操作系统信息 |
--os-features | - | 设置操作系统特性 |
--os-version | - | 设置操作系统版本 |
--variant | - | 设置 CPU 架构的特性,如 arm64 架构的 v7 或 v8 特性 |
1.4. 示例
- 修改多架构镜像中某个镜像的操作系统注释信息
先查看原始的多架构镜像信息
# docker manifest inspect harbor.cncfstack.com/library/redis:6.2.6-multi
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1573,
"digest": "sha256:3991cfe7ed07a7080c79a3b52e38e81caf13f9aa013b0bf588807f4637176515",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1572,
"digest": "sha256:6c1a95df60f12a3b014fa5c85a9c04e742eb2686db2a9f212d49974188ebf0ec",
"platform": {
"architecture": "arm64",
"os": "linux",
"variant": "v8"
}
}
]
}
修改多架构镜像中 amd64 镜像的操作系统信息。
注意命令参数需要先指定多架构镜像,然后再指定多架构镜像中某个镜像
# docker manifest annotate --os-version "centos8" harbor.cncfstack.com/library/redis:6.2.6-multi harbor.cncfstack.com/library/redis:6.2.6-amd64
修改完成在查看,会看到多了 "os.version": "centos8"
的注释信息
# docker manifest inspect harbor.cncfstack.com/library/redis:6.2.6-multi
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1573,
"digest": "sha256:3991cfe7ed07a7080c79a3b52e38e81caf13f9aa013b0bf588807f4637176515",
"platform": {
"architecture": "amd64",
"os": "linux",
"os.version": "centos8"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1572,
"digest": "sha256:6c1a95df60f12a3b014fa5c85a9c04e742eb2686db2a9f212d49974188ebf0ec",
"platform": {
"architecture": "arm64",
"os": "linux",
"variant": "v8"
}
}
]
}