我的平台是 x86,我想要构建多平台镜像,但是 docker buildx ls 但是没有 arm 和 mips 等等其他平台

╰─➤  docker buildx ls                                                                                                                                                                                                                                                                      1 ↵

NAME/NODE            DRIVER/ENDPOINT             STATUS  BUILDKIT PLATFORMS
admiring_mahavira *  docker-container                             
  admiring_mahavira0 unix:///var/run/docker.sock running v0.9.3   linux/amd64, linux/386
default              docker                                       
  default            default                     running v0.11.6  linux/amd64, linux/amd64/v2, linux/386

怎么办?怎么让 arm 这些东西都出现?

我参考了:构建多架构镜像的最佳实践

然后在命令行输入 docker run --privileged --rm tonistiigi/binfmt --install all

─➤   docker run --privileged --rm tonistiigi/binfmt --install all


Unable to find image 'tonistiigi/binfmt:latest' locally
latest: Pulling from tonistiigi/binfmt
2a625f6055a5: Pull complete 
71d6c64c6702: Pull complete 
Digest: sha256:8de6f2decb92e9001d094534bf8a92880c175bd5dfb4a9d8579f26f09821cfa2
Status: Downloaded newer image for tonistiigi/binfmt:latest
installing: riscv64 OK
installing: arm64 OK
installing: arm OK
installing: s390x OK
installing: ppc64le OK
installing: mips64le OK
installing: mips64 OK
{
  "supported": [
    "linux/amd64",
    "linux/arm64",
    "linux/riscv64",
    "linux/ppc64le",
    "linux/s390x",
    "linux/386",
    "linux/mips64le",
    "linux/mips64",
    "linux/arm/v7",
    "linux/arm/v6"
  ],
  "emulators": [
    "qemu-aarch64",
    "qemu-arm",
    "qemu-mips64",
    "qemu-mips64el",
    "qemu-ppc64le",
    "qemu-riscv64",
    "qemu-s390x"
  ]
}

我就拥有了一切

╰─➤  docker buildx ls     

NAME/NODE            DRIVER/ENDPOINT             STATUS  BUILDKIT PLATFORMS
admiring_mahavira    docker-container                             
  admiring_mahavira0 unix:///var/run/docker.sock running v0.9.3   linux/amd64, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
mybuilder *          docker-container                             
  mybuilder0         unix:///var/run/docker.sock running v0.9.3   linux/amd64, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
default              docker                                       
  default            default                     running v0.11.6  linux/amd64, linux/amd64/v2, linux/386, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

universe_king
3.4k 声望680 粉丝