title: building Docker image on Apple Silicon vs Apple Intel, Intel version can run on both; Silicon one can't run at all
body: <p>I have a Dockerfile that uses a third party image (for which there is no arm version because the underlying software currently cannot be built for arm) to build my own C++ code into an executable.</p>
  <pre><code>FROM nrel/openstudio-3.0.1
  
  COPY source .
  
  # make application and define entrypoint
  </code></pre>
  <p><code>docker build . --tag test/test &amp;&amp; docker run --rm -it test/test</code> successfully builds and runs on my Intel Mac. No warnings, nothing.</p>
  <p>If I put that image on my new Apple Silicon machine and run <code>docker run --rm -it test/test</code> I get the following warning message, but otherwise the application runs perfectly</p>
  <p><code>WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested</code></p>
  <p>If I copy the Dockerfile and code over to my Apple Silicon machine and run it (not using <code>--platform</code> because I didn't on the other machine), it successfully builds. When I run it, I get the same warning, but then I also get</p>
  <pre><code>standard_init_linux.go:228: exec user process caused: exec format error
  </code></pre>
  <p>So the Intel-built image runs on both. Just a warning on the ARM processor that I'm running an amd64 image instead of arm64 (and thus will be emulated).</p>
  <p>But the ARM-built image won't run even though it will build.</p>
  <p>Any thoughts? I really don't know what could be the problem since the Intel build <em>works</em> on the ARM machine, and the ARM Dockerfile successfully builds.</p>
  <p><strong>Edit</strong> The base image (openstudio) does not have an ARM version, so I don't think I need to specify platform for building the image. It should only ever use the amd64 image they provide. Right?</p>