Running Docker images from other architectures, on Linux
This post's featured URL for sharing metadata is https://www.jvt.me/img/profile.jpg.
As I'd noted in Creating cross-compiled Docker images from Go binaries, I've been doing some work recently for container image builds.
As I'm putting the finishing touches to my talk at GopherCon UK for the end of this week, I'm creating a pre-built container to simplify setup.
However, to debug this issue with go install
, I found that I needed to be able to run the cross-compiled ARM64 container on my AMD64 machine.
I found StereoLabs' blog post useful, and on top of it needed to install the right packages for me.
I found that on Arch Linux, I needed to:
# make sure qemu-user-static is installed
$ sudo pacman -S qemu-user-static{,-binfmt}
# not 100% sure if this is needed on top of the `-binfmt` package, but after I'd done these both, it all worked
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
You can then run:
% docker run --platform=linux/amd64 --rm -t golang:1.24 uname -a
Linux c464d56a0f62 6.15.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 02 Aug 2025 01:20:06 +0000 x86_64 GNU/Linux
% docker run --platform=linux/arm64 --rm -t golang:1.24 uname -a
Linux 74c62f138743 6.15.9-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 02 Aug 2025 01:20:06 +0000 aarch64 GNU/Linux