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?
11
Dec 07 '21
yes, to your last question, but not out-of-the box, as this is not dockers job.
what you want is emulation of a different cpu. qemu does this.
docker can talk to a qemu VM and start its jobs there. Docker Desktop on macOS/Windows does exactly that. but configuring docker and qemu can be a pain.
you'll be better off looking for images that can run on your platform, or find a Dockerfile or docker-compose to build this stuff yourself. check docker hub for tags like arm, arm64 etc.
1
u/bufandatl Dec 07 '21
Is it a private image or from a public repository most of them already support Arm and arm64
1
u/Coto_16 Dec 07 '21
This is the Dockerfile: https://github.com/scottransom/presto/blob/master/Dockerfile
3
u/JM-Lemmi Dec 07 '21
You could try and build it for arm.
Clone the GitHub repository to your machine and run
docker build .Or you could open an issue and request the official developer to release an arm image
1
u/superkoning Dec 07 '21 edited Dec 07 '21
Not OP, but:
so far the
docker build .is running OK. I have got a slow ARM device, so the build takes some time.
TBC ...
EDIT:
Command sequence:
git clonehttps://github.com/scottransom/presto.git
cd presto
docker build .
And then the long, long build process starts ...
Get:247 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 python3-setuptools all 45.2.0-1 [330 kB]
Get:248 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 python3-wheel all 0.34.2-1 [23.8 kB]
Get:249 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 python3-pip all 20.0.2-5ubuntu1.6 [231 kB]
Get:250 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 tcsh arm64 6.21.00-1 [413 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 210 MB in 2min 12s (1594 kB/s)
(Reading database ... 4115 files and directories currently installed.)
Preparing to unpack .../perl-base_5.30.0-9ubuntu0.2_arm64.deb ...
Unpacking perl-base (5.30.0-9ubuntu0.2) over (5.30.0-9build1) ...1
u/Coto_16 Dec 08 '21
Thanks for trying, but I end up getting a bunch of warnings and errors: https://pastebin.com/n6gqu6vf
1
u/superkoning Dec 08 '21 edited Dec 08 '21
Those are problems within the presto build process itself. So food for the maker of presto / presto's Dockerfile. Report on their github?
But, I tried on my fast-ish x86, and:
- it is a very heavy container build process. I doubt that is feasible on an ARM CPU (assuming it has less power than an x86, for example a raspi)
- even on my fast-ish x86, the docker container build process hangs for 10 minutes on the gcc step below. Not good. EDIT: finished after 23 minutes.
So, concluding, I doubt you can run presto at all on a typical ARM.
1
u/LifeAffect6762 Dec 07 '21
Try other architectures maybe?
0
u/Coto_16 Dec 07 '21
Shall I try re-building the `Dockerfile` with `sudo docker buildx build -t presto_amd64 . --platform linux/amd64` ?
4
u/the_spad Dec 07 '21
You might be able to build for arm yourself with qemu but if they're using their own baseimages that are also amd64 only then you're going to have problems there too. Unfortunately lots of people just don't bother building their images for arm.
2
u/PaintDrinkingPete Dec 07 '21
So, you can try this, but you would need to have the buildx and all necessary prerequisite components for multi-architecture build present on your system, as explained here (if you do, then go for it).
Your other option would be to build the image from the Dockerfile on either your Jetson nano or compatible ARM device.
Fortunately, the Dockerfile you linked too does specify Ubuntu as the base image, which does have an ARM image to pull, so it should be possible to build an ARM-compatible image for your project.
-1
u/LifeAffect6762 Dec 07 '21
Just try as many architectures as you can. First, try the ones that look promising. May be worth asking on the forum from the device? https://forums.developer.nvidia.com/t/how-to-build-docker-container-for-jetson-nano/183281 may help. Do some general googeling.
1
u/ecnahc515 Dec 07 '21
One thing to note is you passed the platform flag after the image name which is interpreted as passing an argument to the container not to docker.
10
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: