# docker pull --platform arm64 alpine Using default tag: latest latest: Pulling from library/alpine 9b3977197b4f: Pull complete Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 Status: Downloaded newer image for alpine:latest docker.io/library/alpine:latest
完成后再次运行镜像,查看该镜像所属的平台,会提示如下警告信息
shell
1 2 3
# docker run --rm alpine uname -m WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested standard_init_linux.go:228: exec user process caused: exec format error
# 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: ppc64le OK installing: mips64le OK installing: arm64 OK installing: arm OK installing: s390x OK installing: riscv64 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" ] }
在成功添加跨平台支持后,再次运行跨平台镜像
shell
1 2 3
# docker run --rm alpine uname -m WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested aarch64