how to run arm64 docker images on amd64 host platform

Viewed 3317

getting the following error upon attempting to run an image created on my mac m1 to the Docker playground website

WARNING: The requested image's platform (linux/arm64) does not match the detected host platform (linux/amd64) and no specific platform was requested

is there a way to make it possible?

1 Answers

Can you share how you are building your image with us please?

You can build multi arch images from a single host, but you will need to ensure that you pass the correct flags to to Docker when building. In your case, you will need to target linux/amd64 in order to get it to run on the host you are targeting.

The example included in the above article is as such, using docker buildkit:

~/test ❯❯❯ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t adamparco/demo:latest --push .

Or if you have not enabled buildkit yet (I think it's on be default with docker desktop now), you can use the old way via docker manifests, per this example:

# AMD64
$ docker build -t your-username/multiarch-example:manifest-amd64 --build-arg ARCH=amd64/ .
$ docker push your-username/multiarch-example:manifest-amd64

# ARM32V7
$ docker build -t your-username/multiarch-example:manifest-arm32v7 --build-arg ARCH=arm32v7/ .
$ docker push your-username/multiarch-example:manifest-arm32v7

# ARM64V8
$ docker build -t your-username/multiarch-example:manifest-arm64v8 --build-arg ARCH=arm64v8/ .
$ docker push your-username/multiarch-example:manifest-arm64v8 
Related