I have a dockerfile to build a simple react app for deployment to GKE. But I get a crashloopback error when I run the following command:
kubectl create deployment react-web --image=gcr.io/qwiklabs-gcp-00-a41e63735e00/react-docker-app:v1
My dockerfile has the following contents:
# build environment FROM node:8 as react-build WORKDIR /app ENV PATH /app/node_modules/.bin:$PATH COPY package.json /app/package.json RUN npm install --silent RUN npm install [email protected] -g --silent COPY . /app RUN npm run build # production environment FROM nginx:alpine COPY --from=react-build /app/build /usr/share/nginx/html EXPOSE 80 CMD [“nginx”, “-g”, “daemon off;”]
I then ran
kubectl describe pod react-web and an error code of 127 was returned.
results of kubectl describe pod
I also ran
docker run react-docker-app to test if it runs locally but I got this output:
/bin/sh: [“nginx”,: not found /bin/sh: ”]: not found
Can this error be because I don’t have nginx installed on my local machine?
Or is there a relationship between not having nginx installed and the crashloopbackoff error.
NB: Kubernetes cluster has two pods.