<p>I have a simple docker image which is working fine locally.
It is basically the same as the example on apache's <a href="https://hub.docker.com/_/httpd" rel="nofollow noreferrer">httpd page.</a></p>
<pre><code>FROM httpd:2.4
COPY ./public-html/ /usr/local/apache2/htdocs/
</code></pre>
<p>As per the page example, I can build and run my image as follows:</p>
<p><code>$ docker build -t gcr.io/${PROJECT_ID}/hello-app:v1 . </code></p>
<p><code>$ docker run -dit --name my-running-app -p 8080:80 &lt;img_id&gt;</code></p>
<p>I then head over to http://localhost:8080 , and everything seems to be working as it should.</p>
<p>However, when I try to create a deployment for my Google Cloud Kubernetes instance, my pod fails and gets to the state of <code>CrashLoopBackOff</code>.  (This is after I have pushed the image to Google Cloud Registry, so that the deployment may grab the image from there.)</p>
<p>I think that this <code>CrashLoopBackOff</code> problem is happening due to me not having an <code>ENTRYPOINT</code> to my container; ie, the pod spawns, no command is issued, and then it is completed and crashes.</p>
<p>I have 2 questions then:</p>
<ol>
<li>What command should I add to my Dockerfile to get the http server up and running on the pod (assuming my assessment of the problem is indeed correct)?</li>
<li>How is this running locally? Locally I simply <code>$ docker run -dit --name my-running-app -p 8080:80 &lt;img_id&gt;</code>. I do not specify that the container should run httpd, yet it does? How is this happening?</li>
</ol>
<p>Edit - additional information:</p>
<p>I deployed onto K8's by doing the following:</p>
<p><code>$ kubectl create deployment hello-app --image=gcr.io/${PROJECT_ID}/hello-app:v1</code></p>
<p>Kubectl logs:</p>
<p><code>$ kubectl logs &lt;pod_name&gt;</code></p>
<p><code>standard_init_linux.go:211: exec user process caused &quot;exec format error&quot;</code></p>
<p>kubectl describe:</p>
<p><code>$ kubectl describe pod hello-app-6b89cd98f6-gn65p</code></p>
<pre><code>Name:         &lt;name&gt;
Namespace:    default
Priority:     0
Node:         &lt;my_node&gt;
Start Time:   Mon, 22 Mar 2021 12:32:51 +0200
Labels:       app=hello-app
              pod-template-hash=6b89cd98f6
Annotations:  &lt;none&gt;
Status:       Running
IP:           10.12.1.13
IPs:
  IP:           10.12.1.13
Controlled By:  &lt;replica_set&gt;
Containers:
  hello-app:
    Container ID:   &lt;cid&gt;
    Image:          &lt;img&gt;
    Image ID:       &lt;img_id&gt;
    Port:           &lt;none&gt;
    Host Port:      &lt;none&gt;
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
      Started:      Mon, 22 Mar 2021 15:12:18 +0200
      Finished:     Mon, 22 Mar 2021 15:12:18 +0200
    Ready:          False
    Restart Count:  36
    Environment:    &lt;none&gt;
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-b8p9t (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  default-token-b8p9t:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-b8p9t
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  &lt;none&gt;
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason   Age                    From     Message
  ----     ------   ----                   ----     -------
  Warning  BackOff  4m9s (x741 over 164m)  kubelet  Back-off restarting failed container
</code></pre>

orrymr
<p><code>CrashLoopBackOff</code> error means the pod keeps crashing and kubernetes has given up on it. You have to determine what is causing the crash.
Overally the cause of problem may be that:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/41604499/my-kubernetes-pods-keep-crashing-with-crashloopbackoff-but-i-cant-find-any-lo">type of parameters of the pod or container have been configured incorrectly</a></li>
<li>the application inside the container keeps crashing</li>
<li><a href="https://stackoverflow.com/questions/35537834/debugging-a-container-in-a-crash-loop-on-kubernetes">an error occurred while deploying Kubernetes</a></li>
</ul>
<p>You can type <code>watch kubectl describe &lt;pod-name&gt;</code> to check events as the pod is being created.  But if the pod crashes after it starts up, you need to get the container logs <code>kubectl logs -f &lt;your-pod-name&gt;</code>.</p>
<p>Read more: <a href="https://sysdig.com/blog/debug-kubernetes-crashloopbackoff/" rel="nofollow noreferrer">kubernetes-crashloopbackoff</a>.</p>
<p>As @<a href="https://stackoverflow.com/users/5147259/krishna-chaurasia" title="6,924 reputation">Krishna Chaurasia</a> said check the  <a href="https://stackoverflow.com/questions/58298774/standard-init-linux-go211-exec-user-process-caused-exec-format-error">thread</a>  which is implying that the default command being run is not an executable - executable formats could be different for different platforms. As @<a href="https://stackoverflow.com/users/3800060/sagar-velankar" title="501 reputation">Sagar Velankar</a> mentioned use in Docker file in <code>FROM</code> line  <code>--platform</code> flag to specify linux/amd64 as the target architecture. See:  <a href="https://docs.docker.com/engine/reference/builder/#from" rel="nofollow noreferrer">dockerfile-from</a>.</p>
<p>You can use <a href="https://docs.docker.com/buildx/working-with-buildx/" rel="nofollow noreferrer">docker buildx</a> <a href="https://docs.docker.com/docker-for-mac/multi-arch/" rel="nofollow noreferrer">docs.docker.com/docker-for-mac/multi-arch</a> to build and push multi architecture images and kubelet will pull the image with correct architecture.</p>
