title: httpd and php-fpm dockerfile, unable to run php-fpm with non-root user
body: <p>Motto is to run docker container with non-root user &amp; got stuck at php-fpm error.
  unable to figure out the issue...</p>
  <blockquote>
  <p>NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root</p>
  </blockquote>
  <blockquote>
  <p>NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root</p>
  </blockquote>
  <p>The problem is its giving same error, even though i changed configuration files with another user name.
  I've already edited the <code>www.conf</code> config at <code>/etc/php-fpm.d/www.conf</code> with:</p>
  <pre><code>[www]
  user = www-data
  group = www-data
  
  listen = /var/run/www.sock
  
  listen.owner = www-data
  listen.group = www-data
  listen.mode = 0660
  ;listen.acl_users = apache,nginx
  </code></pre>
  <p>i also edited <code>httpd.conf</code> configuration <code>/etc/httpd/conf/httpd.conf</code></p>
  <pre><code>Listen 8080
  User www-data
  Group www-data
  
  </code></pre>
  <p>The Dockerfile which includes all the process of installation, i used different user to execute <strong>httpd</strong> and <strong>php-fpm</strong>.
  Here httpd is running with non-root i.e. www-data, however php-fpm is not running with non-root.
  It is giving error as</p>
  <blockquote>
  <p>NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root</p>
  </blockquote>
  <blockquote>
  <p>NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root</p>
  </blockquote>
  <pre><code>FROM amazonlinux:latest
  MAINTAINER ********
  RUN yum update -y
  RUN amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
  RUN yum install -y httpd sudo
  RUN yum install -y php-mbstring php-gd php-pecl-zip php-pdo
  COPY sourcecode /var/www/html/
  COPY httpd.conf /etc/httpd/conf/httpd.conf
  COPY www.conf /etc/php-fpm.d/www.conf
  RUN groupadd www-data &amp;&amp; useradd -g www-data www-data -s /bin/bash
  RUN chown -hR www-data:www-data /run/httpd/ &amp;&amp; chown -hR www-data:www-data /var/www/ &amp;&amp; chown -hR www-data:www-data /etc/httpd/ &amp;&amp; chown -hR www-data:www-data /var/log/httpd/ &amp;&amp; chown -hR www-data:www-data /etc/php* &amp;&amp; chown -hR www-data:www-data /run/php-fpm &amp;&amp; chown -hR www-data:www-data /var/log/php-fpm
  
  #setcap to bind to privileged ports as non-root
  RUN setcap 'cap_net_bind_service=+ep' /usr/sbin/httpd &amp;&amp;  getcap /usr/sbin/httpd
  
  USER 1000
  CMD /usr/sbin/php-fpm -D ; /usr/sbin/httpd -D FOREGROUND
  EXPOSE 8080
  </code></pre>
  <p>What might be the issue, iam unable to get the issue..!
  Is there anyother way to run container with non-root?</p>