<p>I have created an image of my app using docker and when I run the docker image on my local machine it runs successfully, but the same image is erroring out when running using kubernetes.
The error is: <code>exec /docker-entrypoint.sh: exec format error</code>
Upon surfing the net for possible solutions I found the suggestion to add the shebang at the start of the <code>docker-entrypoint.sh</code>. But this is a default .sh file as I've not specified any ENTRYPOINT in my dockerfile. I am not able to understand where to add the shebang.</p>
<p>Here is my dockerfile:</p>
<pre><code># pull the official base image
FROM node:18-alpine as builder
ENV NODE_ENV production
# set working direction
WORKDIR /app
# install application dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm i --production
# add app
COPY . .
# Build the app
RUN npm run build

# Bundle static assets with nginx
FROM nginx:1.23.1-alpine as production
ENV NODE_ENV production
# Copy built assets from builder
COPY --from=builder /app/build /usr/share/nginx/html
# Add your nginx.conf
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port
EXPOSE 80
# Start nginx
CMD [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;]
</code></pre>
<p>Some information about the image created:</p>
<pre><code>&quot;Architecture&quot;: &quot;arm64&quot;,
&quot;Variant&quot;: &quot;v8&quot;,
&quot;Os&quot;: &quot;linux&quot;,
&quot;Cmd&quot;: [&quot;nginx&quot;, &quot;-g&quot;, &quot;daemon off;&quot;],
&quot;Entrypoint&quot;: [&quot;/docker-entrypoint.sh&quot;]
</code></pre>

SHRUTHI BHARADWAJ
<p>Try something like in you <strong>Dockerfile</strong></p>
<pre><code>FROM --platform=linux/amd64 node:18-alpine as builder
</code></pre>
<p>Build the image and run it on K8s.</p>
<p>it could be due to the building image on Mac or Arm and your K8s cluster is not supporting that architecture.</p>
