ARM 架构的 Dockerfile 父级

Dockerfile parent for ARM architecture

我想为 AMD 和 ARM Graviton2 处理器构建 Docker 映像。我已经知道多体系结构 CLI 命令 docker buildx build --platform linux/amd64,linux/arm64、清单以及 Docker 将拉出正确的图像变体匹配体系结构的事实。

我想知道我是否必须在我的 Docker 文件中使用 ARM 作为父 arm64v8/ubuntu:20.04 or it's fine to use ubuntu:20.04 for both? Will it work the same way on both architectures? What's the purpose of this official arm64v8 dockerhub 存储库?

构建时间存在显着差异 - FROM ubuntu:20.04 为 5 分钟,而 FROM arm64v8/ubuntu:20.04 为 30 分钟。

好的,所以我发现这 ubuntu:20.04 and this arm64v8/ubuntu:20.04 两个图像具有完全相同的 SHA。所以 Ubuntu:20.04 只是所有这些 per-arch 图像的父图像,如果你 运行 docker manifest inspect ubuntu 你会看到所有图像。

很明显,arm64v8/ubuntu:20.04 repo 仅适用于您想要在不同架构上构建 ARM 映像的情况(如果您不想使用 multibuild buildx 命令)。在这种情况下,您必须开始使用 FROM arm64v8/ubuntu:20.04.

编写 Dockerfile