<p>Developed a nextjs app and have deployed it to a kubernetes (AKS) cluster. The docker file looks pretty much identical to the sample nextjs docker files (see <a href="https://github.com/vercel/next.js/blob/v12.3.2/examples/with-docker/Dockerfile" rel="nofollow noreferrer">here</a>).</p>
<p>The pod manifest is nothing special either, all I'm doing is setting some environment variables and setting the container up with the right docker image.</p>
<p>The nextjs app refuses to start on a pod in the AKS cluster.</p>
<p>I have pulled the docker image from the container registry and am able to start it up locally on docker desktop - all works fine.</p>
<p>However, it refuses to start on a kubernetes pod, and I am at my wits end! I overrode the entry point to the container on the pod and have manually tried running <code>node server.js</code> via kubectl inside the container, and... nothing happens. Node just exits after a second which seems to indicate that something is causing nodejs to silently crash.</p>
<p>What could be going wrong here? Is there anyway for me to get more output to try and diagnose this issue?</p>

Umair Butt
<p>Ok, seems like running operations and the final command as nextjs USER as specified in the Dockerfile is the bit that's causing issues in kubernetes. Removing those and running as default, root user fixes the issues.</p>
