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?
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).