参考文档1:https://docs.docker.com/buildx/working-with-buildx/#build-multi-platform-images
需求
- 内核版本 >= 4.8
- 通过 https://docs.docker.com/engine/install/ 安装docker,或参考 https://docs.docker.com/build/buildx/install/ 安装 buildx 插件
步骤
1. 启用 binfmt_misc
1 | docker run --privileged --rm tonistiigi/binfmt --install all |
2. 创建并切换构建器
1 | docker buildx create --name mybuilder |
3. 构建镜像
1 | docker buildx build --platform linux/amd64,linux/arm64 -t openspug/spug-service --push . |