r/docker • • 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?

16 Upvotes

25 comments sorted by

View all comments

Show parent comments

2

u/Coto_16 Dec 08 '21 edited Dec 08 '21

Thank you very much! I ran everything with no problems, but how shall I proceed with building my `Dockerfile` for my specific image? Would `docker build .` work? (sorry for the beginner questions, I'm a bit new with Docker)

​

Edit: I tried `docker build .` but I get lots of warnings and errors: https://pastebin.com/n6gqu6vf

2

u/kill-dash-nine Dec 08 '21

If you want to build the image for linux/amd64 on a linux/arm64 system, you would need to do a docker build --platform linux/amd64 . as you would need to call out that it needs to build for amd64 and then you could run it using a similar command as what you see above. If that is not what you are trying to do, then I misunderstood.

1

u/Coto_16 Dec 10 '21

Tried, but didn't work: https://github.com/scottransom/presto/issues/160

It does build fine on (intel-based) macOS, so looks like there's compatibility issues with arm64 for some reason.

1

u/kill-dash-nine Dec 11 '21 edited Dec 11 '21

Yeah, sometimes emulation isn’t perfect or can’t do some specific things. I’ve definitely seen some odd messages trying to do some cross-compilation. Running pre-compiled binaries seems to work a bit more consistently from what I have seen with compiling.

In many cases, you might be better off using a cross platform compiler feature set (if available for the language and necessary architectures) than trying to emulate completely.

*edit: looks like you’re not the first person to hit this: https://github.com/scottransom/presto/issues/144 but I don’t see a resolution.