Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker get-started: WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64)

I'm starting the "get-started" guide from official Docker website. At the Part 4 "Share the application", I'm facing this error message when I try to run my image on the docker hub from play-with-docker.com.

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

I built the image from my apple M1 laptop:

FROM node:12-alpine
# Adding build tools to make yarn install work on Apple silicon / arm64 machines
RUN apk add --no-cache python2 g++ make
WORKDIR /app
COPY . .
RUN yarn install --producti
CMD ["node", "src/index.js"]
like image 324
Srevinu Avatar asked Sep 06 '25 04:09

Srevinu


2 Answers

If you want to run the image on a linux/amd64 platform, you need to build it for that platform. You can do that with docker buildx like this and specify both your platforms

docker buildx build --platform linux/amd64,linux/arm64 -t <tag> .
like image 67
Hans Kilian Avatar answered Sep 10 '25 10:09

Hans Kilian


I had the same error as srevinu as I was also using the tutorial which points to using the docker playground.

This sequence will build and push to docker hub so that it can be run on docker playground.

  1. On your osx arm based computer docker buildx build --platform linux/amd64,linux/arm64 -t <YOUR_DOCKERHUB_ID/getting-started --push .

(If it gives an error and suggestion about issuing a docker buildx create --use, enter the command verbatim.)

After this command in tags pane on docker hub, you should see two platforms listed for the image. One image for linux/amd64 and one for linux/arm64.

enter image description here

  1. On docker playground in the instance, docker run -dp 3000:3000 --platform linux/amd64 johndavis940/getting-started

The image will run and the port icon will be functional.

like image 25
netskink Avatar answered Sep 10 '25 10:09

netskink