在更新 seedgou/zerotier-moon 的时候,尝试了构建多架构的镜像并上传至 Docker Hub 上,记录一下。
安装 QEMU
安装 QEMU 提供多架构 CPU 的模拟。
1 | $ apt install -y qemu-user-static binfmt-support |
运行 docker buildx ls
,查看可用的架构:
1 | $ docker buildx ls |
创建 buildx 实例
运行 docker buildx create --use
创建一个 builder。
构建并上传
运行构建命令并上传
1 | $ docker buildx build -t seedgou/zerotier-moon:edge --platform=linux/amd64,linux/386,linux/ppc64le . --push |
其中 seedgou/zerotier-moon:edge
为 Docker image 的 tag 名称, linux/amd64,linux/386,linux/ppc64le
为架构名称。
参考
Leverage multi-CPU architecture support | Docker Documentation