Run docker image for arm64 on amd64
Display the host architecture
uname -m
x86_64Let’s try run image with arm64. We’ve got an error
docker run --rm -t arm64v8/ubuntu uname -m
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64/v3) and no specific platform was requested
exec /usr/bin/uname: exec format errorInstall the qemu packages
sudo apt-get install qemu binfmt-support qemu-user-staticThis step will execute the registering scripts
docker run --rm --privileged multiarch/qemu-user-static --reset -p yesCheck
cat /proc/sys/fs/binfmt_misc/qemu-aarch64
enabled
interpreter /usr/bin/qemu-aarch64-static
flags: F
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff
ls /usr/bin/qemu-aarch64*
/usr/bin/qemu-aarch64_be-static /usr/bin/qemu-aarch64-staticTesting the emulation environment
docker run --platform linux/arm64 --rm -t arm64v8/ubuntu uname -m
aarch64Useful links: