Search code examples
dockerapple-m1dockerhub

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"]

Solution

  • 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> .