title: How to change the nginx process user of the official docker image nginx?
body: <p>I'm using Docker Hub's official nginx image:
  <a href="https://hub.docker.com/_/nginx/" rel="noreferrer">https://hub.docker.com/_/nginx/</a></p>
  
  <p>The user of nginx (as defined in /etc/nginx/nginx.conf) is <code>nginx</code>. Is there a way to make nginx run as <code>www-data</code> without having to extend the docker image? The reason for this is, I have a shared volume, that is used by multiple containers - <code>php-fpm</code> that I'm running as <code>www-data</code> and <code>nginx</code>. The owner of the files/directories in the shared volume is <code>www-data:www-data</code> and <code>nginx</code> has trouble accessing that - errors similar to <code>*1 stat() "/app/frontend/web/" failed (13: Permission denied)</code></p>
  
  <p>I have a <code>docker-compose.yml</code> and run all my containers, including the nginx one with <code>docker-compose up</code>.</p>
  
  <pre><code>  ...
    nginx:
      image: nginx:latest
      ports:
        - "80:80"
      volumes:
        - ./:/app
        - ./vhost.conf:/etc/nginx/conf.d/vhost.conf
      links:
        - fpm
  
    ...
  </code></pre>