如何使用docker desktop 下载x86、amd64、arm64 镜像?
环境
修改配置
官网地址,开启 Docker CLI 的实验特性
docker desktop 的Preferences=>>Docker Engine
experimental 的值设置成 true,意思是:开启manifest实验特性
{
"registry-mirrors": [
"https://registry.cn-hangzhou.aliyuncs.com"
],
"insecure-registries": [
"0.0.0.0/0",
"dockerhub.kubesphere.local:443"
],
"debug": true,
"experimental": true
}
重启docker后下载镜像
–platform=arm64指定CPU平台架构的镜像
➜ ~ docker pull --platform=arm64 nginx:latest
latest: Pulling from library/nginx
d10c227306ce: Pull complete
6d7f45405386: Pull complete
1b5147f94884: Pull complete
52ae3a597441: Pull complete
3ce50094efa7: Pull complete
7bf647869efa: Pull complete
Digest: sha256:853b221d3341add7aaadf5f81dd088ea943ab9c918766e295321294b035f3f3e
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest
验证镜像架构
docker manifest inspect --insecure nginx:latest
➜ ~ docker manifest inspect --insecure nginx:latest
^[{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:6fe11397c34b973f3c957f0da22b09b7f11a4802e1db47aef54c29e2813cc125",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:f6d65972ac54772c5f6b952e396aad3e516fcb250cd5825b98a33a82286c91c2",
"platform": {
"architecture": "arm",
"os": "linux",
"variant": "v5"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:8f4514d178b1f178fa04a5307695a7477af68bf95e78ec0ec6172a7ab06c30a2",
"platform": {
"architecture": "arm",
"os": "linux",
"variant": "v7"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:f68304ec388f969b0929d695a05a36ecdb3665009258631cb898ba046963e72a",
"platform": {
"architecture": "arm64",
"os": "linux",
"variant": "v8"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:0b5b438edb8be60c445a89a4c9043681ea16ef1cfcc0e9c168c059d76fb8e04e",
"platform": {
"architecture": "386",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:3e0cbe127ddfb82dde1e6c150199cfdfdc35c6a4a3cb7b7ff5f8c09e47df00be",
"platform": {
"architecture": "mips64le",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:2472887e70008a6ed87a004c5c70e5fbc6e2e47aeac3d76d149669a4119f4bd6",
"platform": {
"architecture": "ppc64le",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1570,
"digest": "sha256:ef218d58b531ffaf0702b4d8f14501e6d84b25efe384171eb0e839a2f662e676",
"platform": {
"architecture": "s390x",
"os": "linux"
}
}
]
}