title: nginx: invalid option: "off" and entrypoint.sh: : Permission denied
body: <p>I am creating build using Dockerfile and then deploying that build/image via jenkins job but container status is &quot;CrashLoopBackOff&quot; and when I am checking the logs,  below error occurs..</p>
  <p>Error:-</p>
  <pre><code>nginx: invalid option: &quot;off&quot;
  /etc/nginx/entrypoint.sh: 5: /etc/nginx/entrypoint.sh: : Permission denied 
  </code></pre>
  <p>Note:- Full permission given to entrypoint.sh. (check the dockerfile)</p>
  <p>Dockerfile:-</p>
  <pre><code>FROM node:12.18.4-alpine AS BUILD_IMAGE
  WORKDIR /app
  
  # add `/app/node_modules/.bin` to $PATH
  ENV PATH /app/node_modules/.bin:$PATH
  
  COPY package.json .
  COPY package-lock.json .
  COPY .npmrc .
  RUN npm install
  COPY . .
  RUN npm run build
  
  FROM nginx:latest
  RUN apt-get update
  RUN apt-get -y install sudo
  COPY --from=BUILD_IMAGE /app/build /usr/share/nginx/html
  COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
  COPY .build/envs/uat/env.js /app/uat/env.js
  COPY .build/envs/prod/env.js /app/prod/env.js
  COPY entrypoint.sh /etc/nginx/entrypoint.sh
  RUN  sudo chmod 777 /etc/nginx/entrypoint.sh
  RUN  sudo nginx -t
  RUN  ls -lrt /etc/nginx/
  
  EXPOSE 80
  ENTRYPOINT [&quot;/etc/nginx/entrypoint.sh&quot;]
  # replace ENVIRONMENT with uat, prod
  CMD [&quot;ENVIRONMENT&quot;]
  
  </code></pre>
  <p>entrypoint.sh file:-</p>
  <pre><code>#!/bin/sh
  set -e
  
  if [ &quot;$1&quot; = 'uat' ]; then
      &quot;$(cp /app/uat/env.js /usr/share/nginx/html &amp;&amp; nginx -g daemon off;)&quot;
  elif [ &quot;$1&quot; = 'prod' ]; then
      &quot;$(cp /app/prod/env.js /usr/share/nginx/html &amp;&amp; nginx -g daemon off; )&quot;
  fi
  </code></pre>