'x86 Docker Image on ARM

I have a Docker image that was built and uploaded to Amazon ECR by a x86 machine.

I'm trying to run this image on an ARM machine; however, I'm getting the following:

$sudo docker run 1b3ed34937e8

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

Do I need to rebuild this image? Is it possible to rebuild with only an image and not a dockerfile?



Solution 1:[1]

You are trying to build x86 Docker images on a different architecture (ARM).

Rebuild the images on the Mac, or if you are still building the image on X86 you can set the target platform

docker buildx build --platform darwin/amd64 -t app .

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1