MultiArch Builds
Last updated
Last updated
docker: Error response from daemon: image with reference multiarch/qemu-user-static was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64.
This error message suggests that you are trying to run a Docker image on a platform that is different from the one for which the image was built. The image you are trying to run is built for the linux/arm64
platform, but the platform of your host system is linux/amd64
.
To resolve this issue, you can use a tool called qemu-user-static
to run the linux/arm64
binary on your linux/amd64
system. The qemu-user-static
tool allows you to run binaries for foreign architectures on your host system by providing a lightweight emulation layer.
To use qemu-user-static
, you need to follow these steps:
Install the qemu-user-static
package on your host system. On Ubuntu or Debian, you can do this with the following command:
Download the multiarch/qemu-user-static
Docker image for the linux/arm64
platform:
Register the qemu-user-static
binary as the default interpreter for the linux/arm64
platform:
Try running your Docker image again:
This time, Docker should use the qemu-user-static
binary to run the linux/arm64
binary in your Docker image on your linux/amd64
host system.
I am using macos
I apologize for the confusion. binfmt-support
is a Linux package that provides support for registering binary formats with the kernel, and it's not available on macOS.
On macOS, you can use a tool called docker-binfmt
to register support for foreign architectures. Here are the steps you can follow:
Install docker-binfmt
by running the following command in a terminal:
Enable docker-binfmt
by running the following command:
This command will enable support for various foreign architectures, including linux/arm64
.
Try running your Docker image again:
This time, Docker should be able to run the linux/arm64
binary in your Docker image on your macOS host system.
I hope this helps!