2

This is my docker file

#!/bin/bash
FROM node:10.8.0 as build-stage
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY ./ /app/
ARG configuration=production
RUN npm run build -- --output-path=./dist/out --configuration $configuration
FROM nginx:1.15
#Copy ci-dashboard-dist
COPY --from=build-stage /app/dist/out/ /usr/share/nginx/html
#Copy default nginx configuration
COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf

I am getting error CrashLoopBackOff. When i try to find the log it says exec /usr/sbin/nginx: exec format error. How can i resolve this and get the app running

3
  • Are you potentially building the image on an ARM-based system (like an M1 Mac) but running it on an x86 host, or vice versa? Commented Feb 1, 2023 at 13:53
  • Why do you have Kubernetes tag? Commented Feb 1, 2023 at 13:53
  • @DavidMaze yes, this image is build with M1 Mac, and i am trying to run it on linux kubernetes cluster of x86 host Commented Feb 1, 2023 at 13:57

1 Answer 1

1

Try something like adding --platform=linux/amd64 in your Dockerfile

FROM --platform=linux/amd64 node:18-alpine as builder

Build the image and run it on K8s.

it could be due to the building image on Mac or Arm and your K8s cluster is not supporting that architecture.

The optional --platform flag can be used to specify the platform of the image in case FROM references a multi-platform image. For example, linux/amd64, linux/arm64, or windows/amd64. By default, the target platform of the build request is used.

Doc ref

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.