<p>My own app dockerized on my MacOS M1 Silicon host machine, fails with <code>standard_init_linux.go:190: exec user process caused &quot;exec format error&quot;</code> when launched on Kubernetes cluster, with runs on Linux server.</p>
<p>I have my app with this Dockerfile:</p>
<pre><code>FROM openjdk:11-jre-slim as jdkbase
FROM jdkbase
COPY app/target/dependency-jars /run/dependency-jars
COPY app/target/resources /run/resources
ADD app/target/app-1.0.3.jar /run/app-1.0.3.jar

CMD java -jar run/app-1.0.3.jar
</code></pre>
<p>,this docker-compose.yaml:</p>
<pre><code>version: &quot;3.8&quot;
services:
  myapp:
    build:
      context: .
      dockerfile: myapp/Dockerfile
    hostname: myapphost
</code></pre>
<p>and this pod.yaml</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: myapp
spec:
  containers:
  - name: myapp-container
    image: my.private.repo/app_dir/myapp:1.0.3
  imagePullSecrets:
  - name: st-creds
</code></pre>
<p>I've spent several hours trying to figure it out how to solve it, trying to use diff. variants of Entrypoints and cmds, but non of this was a working option.</p>

<p>The final solution was to build app for certain architecture, adding  platform (<code>platform: linux/amd64</code>) to the compose file:</p>
<pre><code>version: &quot;3.8&quot;
services:
  myapp:
    platform: linux/amd64
    build:
      context: .
      dockerfile: myapp/Dockerfile
    hostname: myapphost
</code></pre>
<p>and also to change base image in the Dockerfile to any java image, which works with amd64, for example, to <code>amd64/openjdk:11-slim</code>, like this:</p>
<pre><code>FROM amd64/openjdk:11-slim as jdkbase
FROM jdkbase
COPY app/target/dependency-jars /run/dependency-jars
COPY app/target/resources /run/resources
ADD app/target/app-1.0.3.jar /run/app-1.0.3.jar

CMD java -jar run/app-1.0.3.jar
</code></pre>
<p>Hope this'll save time to anyone else who is new to Docker as me</p>
