【Docker】02-多架构镜像构建
Summary
Docker 使用 buildx 结合以下几种方式构建多架构镜像,详细参考 Building multi-platform images
- Using the QEMU emulation support in the kernel
- Building on multiple native nodes using the same builder instance
- Using a stage in Dockerfile to cross-compile to different architectures
注:目前看下来,第三种和第一种都是利用了 qemu 的特性
QEMU + binfmt-misc
QEMU allows us to execute binaries from other architectures, and binfmt-misc is the mechanism that maps those binaries (based on their magic bytes) to the appropriate QEMU user-space command.
QEMU 提供执行异构可执行文件的能力,binfmt-misc 标准化可执行文件以适配 QEMU 执行
1 | docker buildx build --platform linux/amd64,linux/arm64 . |
builder nodes
指定构建的节点,加快构建速度
1 | add local |
Further
- buildah 也提供多架构构建的能力,可见 buildah-build
References
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 cv-programmer!






