<p><strong>Intro</strong></p>
<p>There is an option <code>--platform</code> for Docker image to be run and config <code>platform</code> for docker-compose.</p>
<p>Also, almost in all official Docker images in hub.docker.com there is some of supported architectures in one tag.</p>
<p>Example, Ubuntu official image:</p>
<p><a href="https://i.stack.imgur.com/Yuxul.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Yuxul.png" alt="enter image description here" /></a></p>
<p>Most of Servers (also in Kubernetes) are <code>linux/amd64</code>.</p>
<p>I updated my MacBook to new one with their own Silicon chip (M1/M2...) and now Docker Desktop showing me message:</p>
<p><a href="https://i.stack.imgur.com/2hitQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2hitQ.png" alt="enter image description here" /></a></p>
<p>For official images (you can see them without yellow note) it downloads automatically needed platform (I guess).</p>
<p>But for custom created images (in private repository like nexus, artifacts) I have no influence. Yes, I can build appropriate images (like with buildx) for different platforms and push it to the private repository, but, in companies, where repos managed by DevOps - it is tricky to do so. They say that the server architecture is linux/amd64, and if I develop web-oriented software (PHP etc.) on a different platform, even if the version (tag) is the same - then the environment is different, and there is no guarantee that it will work on the server.</p>
<p>I assumed that it is only the difference in interpretation of instructions between the software and the hardware.</p>
<p>I would like to understand the subject better. There is a lot of superficial information on the web, no details.</p>
<p><strong>Questions</strong></p>
<ol>
<li>what &quot;platform/architecture&quot; for Docker image does it really means? Like core basics.</li>
<li>Will you really get different code for interpreted programming languages?</li>
<li>It seems to me that if the wrong platform is specified, the containers work very slowly. But how to measure this (script performance, interaction with the host file system, etc.)</li>
</ol>

Miroff
<h2>TLDR</h2>
<ul>
<li>Build multi-arch images supporting multiple architectures</li>
<li>Always ensure that the image you're trying to run has compatible architecture</li>
</ul>
<hr />
<blockquote>
<ol>
<li>what &quot;platform/architecture&quot; for docker image does it really means? Like core basics. Links would be appreciated.</li>
</ol>
</blockquote>
<p>It means that some of the compiled binary code within the image contains CPU instructions exlusive to that specific architecture.
If you run that image on the incorrect architecture, it'll either be slower due to the incompatible code needing to run through an emulator, or it might even not work at all.
Some images are &quot;multi-arch&quot;, where your Docker installation selects the most suitable architecture of the image to run.</p>
<blockquote>
<p>Will you really get different code for interpreted programming languages?</p>
</blockquote>
<p>Different machine code, yes. But it will be functionally equivalent.</p>
<blockquote>
<p>It seems to me that if the wrong platform is specified, the containers work very slowly. But how to measure this (script performance, interaction with the host file system, etc.)</p>
</blockquote>
<p>I recommend to always ensure you're running images meant for your machine's infrastructure.</p>
<p>For the sake of science, you could do an experiment.
You can build an image that is meant to run a simple batch job for two different architectures, and then you can try running them both on your machine. Compare the time it takes the containers to finish.</p>
<p>Sources:</p>
<ul>
<li><a href="https://serverfault.com/questions/1066298/why-are-docker-images-architecture-specific#:%7E:text=Docker%20images%20obviously%20contain%20processor,which%20makes%20them%20architecture%20dependent">https://serverfault.com/questions/1066298/why-are-docker-images-architecture-specific#:~:text=Docker%20images%20obviously%20contain%20processor,which%20makes%20them%20architecture%20dependent</a>.</li>
<li><a href="https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/" rel="nofollow noreferrer">https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/</a></li>
<li><a href="https://www.reddit.com/r/docker/comments/o7u8uy/run_linuxamd64_images_on_m1_mac/" rel="nofollow noreferrer">https://www.reddit.com/r/docker/comments/o7u8uy/run_linuxamd64_images_on_m1_mac/</a></li>
</ul>
