title: Docker compose throws - adduser: group 'www-data' in use
body: <p>I have a <code>docker-composer.yml</code> file which used to work just fine a couple of months ago, but now when I run it throws an error. </p>
  
  <p>First, this is my file structure. </p>
  
  <pre><code>.data/db
  logs
  mariadb
  nginx
  php7-fpm
  src/public
  .env
  .gitignore
  README
  docker-compose.yml
  </code></pre>
  
  <p>The only mention of the error i.e <code>www-data</code> is in two of the files. <code>php7-fpm/Dockerfile</code> and <code>nginx/Dockerfile</code></p>
  
  <p>Here is the content of these files: </p>
  
  <p>php-fpm/Dockerfile</p>
  
  <pre><code>....
  RUN apt-get update &amp;&amp; apt-get install -y procps
  
  RUN usermod -u 1000 www-data
  
  USER www-data
  
  WORKDIR /var/www
  
  
  nginx/Dockerfile
  
  FROM nginx:alpine
  
  COPY ./config/nginx.conf /etc/nginx/
  COPY ./sites /etc/nginx/sites-available
  RUN apk update \
      &amp;&amp; apk upgrade \
      &amp;&amp; apk add --no-cache bash \
      &amp;&amp; adduser -D -H -u 1000 -s /bin/bash www-data
  
  ARG PHP_UPSTREAM_CONTAINER=php-fpm
  ARG PHP_UPSTREAM_PORT=9000
  
  # Set upstream conf and remove the default conf
  RUN echo "upstream php-upstream { server     ${PHP_UPSTREAM_CONTAINER}:${PHP_UPSTREAM_PORT}; }" &gt; /etc/nginx/conf.d/upstream.conf \
  &amp;&amp; rm /etc/nginx/conf.d/default.conf
  
  CMD ["nginx"]
  </code></pre>
  
  <p>The <code>docker-compose.yml</code> file is a generic one, there is no tampering with user groups, but here is a pastebin for anyone who wants to take a look. </p>
  
  <p><a href="https://pastebin.com/ivRfPvZz" rel="noreferrer">https://pastebin.com/ivRfPvZz</a></p>
  
  <p>This is the partial output from the <code>docker-compose up -d</code> command. </p>
  
  <pre class="lang-sh prettyprint-override"><code>Image for service php-fpm was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.
  Building nginx
  Step 1/8 : FROM nginx:alpine
  alpine: Pulling from library/nginx
  Digest: sha256:17bd1698318e9c0f9ba2c5ed49f53d690684dab7fe3e8019b855c352528d57be
  Status: Downloaded newer image for nginx:alpine
   ---&gt; ea1193fd3dde
  Step 2/8 : COPY ./config/nginx.conf /etc/nginx/
   ---&gt; 65c115482d37
  Step 3/8 : COPY ./sites /etc/nginx/sites-available
   ---&gt; 1fbe81620355
  Step 4/8 : RUN apk update     &amp;&amp; apk upgrade     &amp;&amp; apk add --no-cache bash     &amp;&amp; adduser -D -H -u 1000 -s /bin/bash www-data
   ---&gt; Running in c631ccdf63f2
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
  v3.9.4-61-g22a1991b6a [http://dl-cdn.alpinelinux.org/alpine/v3.9/main]
  v3.9.4-57-gb40ea6190b [http://dl-cdn.alpinelinux.org/alpine/v3.9/community]
  OK: 9776 distinct packages available
  (1/1) Upgrading libbz2 (1.0.6-r6 -&gt; 1.0.6-r7)
  OK: 27 MiB in 37 packages
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/main/x86_64/APKINDEX.tar.gz
  fetch http://dl-cdn.alpinelinux.org/alpine/v3.9/community/x86_64/APKINDEX.tar.gz
  (1/2) Installing readline (7.0.003-r1)
  (2/2) Installing bash (4.4.19-r1)
  Executing bash-4.4.19-r1.post-install
  Executing busybox-1.29.3-r10.trigger
  OK: 29 MiB in 39 packages
  adduser: group 'www-data' in use
  Service 'nginx' failed to build: The command '/bin/sh -c apk update     &amp;&amp; apk upgrade     &amp;&amp; apk add --no-cache bash     &amp;&amp; adduser -D -H -u 1000 -s /bin/bash www-data' returned a non-zero code: 1
  </code></pre>
  
  <p>You can see the error is: </p>
  
  <pre><code>adduser: group 'www-data' in use
  Service 'nginx' failed to build: The command '/bin/sh -c apk update     &amp;&amp; apk upgrade     &amp;&amp; apk add --no-cache bash     &amp;&amp; adduser -D -H -u 1000 -s /bin/bash www-data' returned a non-zero code: 1
  </code></pre>
  
  <p>but I don't know how to fix this.</p>