title: How to run an nginx container as non root?
body: <p>Every time I try to run the container as non root, I get the following error:</p>
  <pre><code> the &quot;user&quot; directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2
  </code></pre>
  <p>Dockerfile:</p>
  <pre><code>FROM nginx:1.17.6
  RUN chown -R nginx:nginx /var/cache/nginx &amp;&amp; \
          chown -R nginx:nginx /var/log/nginx &amp;&amp; \
          chown -R nginx:nginx /etc/nginx/conf.d
  RUN chmod -R 777 /etc/nginx/conf.d
  
  USER nginx
  
  COPY app/build /usr/share/nginx/html
  
  RUN rm /etc/nginx/conf.d/default.conf
  
  COPY nginx/nginx.conf /etc/nginx/conf.d
  
  
  CMD [&quot;nginx&quot;,&quot;-g&quot;,&quot;daemon off;&quot;]
  </code></pre>