title: Dockerfile chown command cannot change the containers folder permission
body: <p>I tried the following post.</p>
  
  <p><a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-laravel-nginx-and-mysql-with-docker-compose" rel="nofollow noreferrer">How to set up laravel nginx and mysql with docker compose</a></p>
  
  <p>But Dockerfile is not changing the permission of /var/www to www:www.</p>
  
  <p>due to that all the php artisan commands are failing..</p>
  
  <p>Any idea why the folder permission of container remains unchanged.</p>
  
  <pre><code>FROM php:7.2-fpm
  
  # Copy composer.lock and composer.json
  COPY composer.lock composer.json /var/www/
  
  # Set working directory
  WORKDIR /var/www
  
  # Install dependencies
  RUN apt-get update &amp;&amp; apt-get install -y \
  build-essential \
  mariadb-client \
  libpng-dev \
  libjpeg62-turbo-dev \
  libfreetype6-dev \
  locales \
  zip \
  jpegoptim optipng pngquant gifsicle \
  vim \
  unzip \
  git \
  curl
  
  # Clear cache
  RUN apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  # Install extensions
  RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
  RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
  RUN docker-php-ext-install gd
  
  # Install composer
  RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  
  # Add user for laravel application
  RUN groupadd -g 1000 www
  RUN useradd -u 1000 -ms /bin/bash -g www www
  
  # Copy existing application directory contents
  COPY . /var/www
  
  # Copy existing application directory permissions
  COPY --chown=www:www . /var/www
  #RUN chown -R www:www /var/www
  
  # Change current user to www
  USER www
  
  # Expose port 9000 and start php-fpm server
  EXPOSE 9000
  CMD ["php-fpm"]
  </code></pre>
  
  <p>Server Debian 9</p>
  
  <p>Below line is not working as expected
      COPY --chown=www:www . /var/www</p>