<p>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:</p>

<pre><code>kubectl create deployment react-web --image=gcr.io/qwiklabs-gcp-00-a41e63735e00/react-docker-app:v1
</code></pre>

<p>My dockerfile has the following contents:</p>

<pre><code># 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 react-scripts@3.0.1 -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;”]
</code></pre>

<p>I then ran <code>kubectl describe pod react-web</code> and an error code of 127 was returned.
<a href="https://i.stack.imgur.com/9Odhi.png" rel="nofollow noreferrer">results of kubectl describe pod</a></p>

<p>I also ran <code>docker run react-docker-app</code> to test if it runs locally but I got this output: </p>

<pre><code>/bin/sh: [“nginx”,: not found
/bin/sh: ”]: not found
</code></pre>

<p>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.</p>

<p>NB: Kubernetes cluster has two pods.</p>

Bash
<p>there is no need to add CMD at the end of the file since the image already comes with that. You are getting the crashloopback because the pod fails at start thus the 127 exit code. </p>

<p>Remove the following line and it should work.</p>

<pre><code>CMD [“nginx”, “-g”, “daemon off;”]
</code></pre>
