0

I have a Dockerfile that works on both mac and windows. But when I create an actual container on mac, I always get a warning that says:

PS /Users/me/> docker run -it platformtest /bin/bash

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
root@0569c6d5ad39:/builds# exit

This is despite the fact that when I create the image, I'm specifying amd64. Here's the relevant part of the Dockerfile:

FROM --platform=amd64 mcr.microsoft.com/dotnet/sdk:6.0.202-bullseye-slim-amd64 AS deployFunctionApp
RUN apt update && apt-get install vim -y
COPY . /builds
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
RUN apt-get install curl && curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install nodejs

And the command I use to create the image is:

 docker build --target deployFunctionApp -t myimagename .

The build happens with no errors or warnings.

Questions

Why do I get this warning eventhough i've specified the platform during the build process? It seems that I can safely ignore it, cuz everything seems to be working. Is there anything that I should be looking out for? Any way to suppress this message?

3
  • If it's a recent model Mac it doesn't have an "amd64" processor (which means Intel/AMD x86); it has an ARM processor (the Apple M1). I am surprised anything runs at all.
    – larsks
    Commented Apr 28, 2022 at 12:44
  • @larsks thanks for the response. Two comments. I realize that the latest mac uses arm64 but ... if I'm trying to write a Dockerfile that will "just work" on windows, mac or linux. FWIW I've tried arm specific images and they bombed. See EDIT 3 on this post: stackoverflow.com/questions/71916483/…
    – dot
    Commented Apr 28, 2022 at 14:05
  • If you're trying to write a Dockerfile that will just work, you should drop the explicit --platform specification (because you want to build images for the current platform, so that someone running under non-Intel architectures builds from the correct images).
    – larsks
    Commented Apr 28, 2022 at 14:15

1 Answer 1

0

The warning is just a warning, though Docker states in Known issues for Docker Desktop > Known issues for Mac with Apple silicon that containers will be slowe, use more memory, and can even crash:

... attempts to run Intel-based containers on Apple silicon machines under emulation can crash as qemu sometimes fails to run the container. In addition, filesystem change notification APIs (inotify) do not work under qemu emulation. Even when the containers do run correctly under emulation, they will be slower and use more memory than the native equivalent.

In summary, running Intel-based containers on Arm-based machines should be regarded as “best effort” only. We recommend running arm64 containers on Apple silicon machines whenever possible, and encouraging container authors to produce arm64, or multi-arch, versions of their containers. We expect this issue to become less common over time,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.