方法一:buildx构建时需要高版本Docker(19.03及以上),运行时不受此约束
linux> docker buildx build -t your_id/python:1.6.0-release --platform linux/amd64,linux/arm64 .
linux> docker buildx build -t your_id/python:1.6.0-release --platform linux/amd64,linux/arm64 . --push
方法二:使用docker manifest
在不同架构机器上分别构造镜像并上传到Docker Hub库中,然后通过docker manifest命令构造manifest列表。
创建manifest列表:
[root@fate-122-131 fate_flow]# docker manifest create your_id/fluentd:v1.12 fluent/fluentd:v1.12-debian-arm64-2 fluent/fluentd:v1.12
Created manifest list docker.io/your_id/fluentd:v1.12
查看manifest列表:
[root@fate-122-131 fate_flow]# docker manifest inspect your_id/fluentd:v1.12
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 1362,
"digest": "sha256:d878d653bd1e13cdc6ecd45ac7c721540ad8e22cf044aa8e7e35f3d7246f5830",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"size": 2413,
"digest": "sha256:86c0e6b59af3d8c50ec25f4df195269e0dc37357be0a969b6ae5c23c937561bc",
"platform": {
"architecture": "arm64",
"os": "linux"
}
}
]
}
推送manifest列表:
[root@fate-122-131 fate_flow]# docker manifest push your_id/fluentd:v1.12