Answers: <p>The warning is just a warning, though Docker states in <a href="https://docs.docker.com/desktop/troubleshoot/known-issues/" rel="nofollow noreferrer">Known issues for Docker Desktop &gt; Known issues for Mac with Apple silicon</a> that containers  will be slowe, use more memory, and can even crash:</p>
  <blockquote>
  <p>... 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.</p>
  </blockquote>
  <blockquote>
  <p>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,</p>
  </blockquote>
  
Answers: CC BY-SA 4.0
Answers: 2023-04-18T14:39:43.913Z
Answers: 2023-04-18T14:39:43.913Z
Answers: Talchu
Body: <p>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:</p>
  <pre><code>PS /Users/me/&gt; 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
  </code></pre>
  <p>This is despite the fact that when I create the image, I'm specifying amd64. Here's the relevant part of the Dockerfile:</p>
  <pre><code>FROM --platform=amd64 mcr.microsoft.com/dotnet/sdk:6.0.202-bullseye-slim-amd64 AS deployFunctionApp
  RUN apt update &amp;&amp; apt-get install vim -y
  COPY . /builds
  RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
  RUN apt-get install curl &amp;&amp; curl -sL https://deb.nodesource.com/setup_12.x | bash -
  RUN apt-get install nodejs
  </code></pre>
  <p>And the command I use to create the image is:</p>
  <pre><code> docker build --target deployFunctionApp -t myimagename .
  </code></pre>
  <p>The build happens with no errors or warnings.</p>
  <p>Questions</p>
  <p>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?</p>
  
Comments: CC BY-SA 4.0
Comments: 2022-04-28T12:44:40.837Z
Comments: 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.
Comments: larsks
Comments: CC BY-SA 4.0
Comments: 2022-04-28T14:05:12.117Z
Comments: @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:  https://stackoverflow.com/questions/71916483/az-cli-missing-on-docker-image-on-mac-after-doing-curl-call
Comments: dot
Comments: CC BY-SA 4.0
Comments: 2022-04-28T14:15:57.013Z
Comments: 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).
Comments: larsks
Tags: <docker><dockerfile><macos>
Title: Docker warning about platform not matching the host platform
UserDisplayName: dot
ThreadText: # Docker warning about platform not matching the host platform
  
  (Asked by: username_0 on 2022-04-26)
  
  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?
  
  **Tags:** docker, dockerfile, macos
  
  > **Comments:**
  > **username_1**: 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.  
  > **username_0**: @username_1 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:  https://stackoverflow.com/questions/71916483/az-cli-missing-on-docker-image-on-mac-after-doing-curl-call  
  > **username_1**: 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).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2023-04-18. Score: 0
  
  The warning is just a warning, though Docker states in [Known issues for Docker Desktop > Known issues for Mac with Apple silicon](https://docs.docker.com/desktop/troubleshoot/known-issues/) 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,
  
  
  ---
  
  