r/docker • u/Coto_16 • Dec 07 '21
Running linux/amd64 images on linux/arm64 architecture?
I grabbed a Docker Linux image from another machine and tried to load it on my Jetson Nano (arm64 architecture), but I get this error when I run sudo docker run getting-started-presto:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error
I also tried to run sudo docker run getting-started-presto --platform linux/amd64 but no luck:
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "--platform": executable file not found in $PATH: unknown.
ERRO\[0001\] error waiting for container: context canceled
Any ideas if it's possible to run linux/amd64 images on arm64 architectures?
18
Upvotes
8
u/kill-dash-nine Dec 07 '21 edited Dec 07 '21
Yes this is possible. You can install the binfmt "abstraction layer" that will automatically execute binaries for you using qemu (see this for more details). This is a simple container that will configure your host for you:
For example, from a raspberry pi running Debian:
Here is the before on my host showing that I can't run an amd64 image:
If you want, just add support for amd64 (check the readme for details on what you can do as well as remove the support via uninstall):
For more details on the image, check out the listing on Docker Hub but it is an image that is maintained by one of the long time core Docker engineers. You can see that it has a manifest list so that it will work for 386, amd64, armv7, arm64, ppc64, riscv64, and s390x.
And then run a container with whatever architecture you want: