title: L aravel Permission denied storage folder using Dockerfile
body: <p>I am using docker-compose.yml to run my Laravel app. Everything works fine if I run</p>
  
  <pre><code>chmod -R 755 storage
  </code></pre>
  
  <p>in the larval root.</p>
  
  <p>But what I want is to define permission on Dockerfile.
  app/docker/web/Dockerfile</p>
  
  <pre><code>FROM php:7.2.10-apache-stretch
  
  RUN apt-get update -yqq &amp;&amp; \
      apt-get install -y apt-utils zip unzip &amp;&amp; \
      apt-get install -y nano &amp;&amp; \
      apt-get install -y libzip-dev libpq-dev &amp;&amp; \
      apt-get install -y libxml2-dev &amp;&amp; \
      apt-get install -y libcurl4-openssl-dev pkg-config libssl-dev &amp;&amp; \
      a2enmod rewrite &amp;&amp; \
      docker-php-ext-configure zip --with-libzip &amp;&amp; \
      docker-php-ext-install zip &amp;&amp; \
      rm -rf /var/lib/apt/lists/*
  
  RUN pecl install mongodb &amp;&amp; \
      docker-php-ext-enable mongodb
  
  RUN curl -sS https://getcomposer.org/installer | php -- --install- 
     dir=/usr/local/bin --filename=composer
  
  COPY default.conf /etc/apache2/sites-enabled/000-default.conf
  
  WORKDIR /var/www/app
  
  ADD . /var/www/app
  
  RUN chown -R www-data: /var/www/app
  RUN chmod -R 755 /var/www/app/storage
  
  CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
  
  EXPOSE 80
  </code></pre>
  
  <p>And docker-compose.yml</p>
  
  <pre><code>version: '3.1'
  services:
      web:
          container_name: ${APP_NAME}
          build:
              context: ./docker/web
          ports:
              - 8088:80
          volumes:
              - ./:/var/www/app
          depends_on:
              - mongo
          links:
              - mongo:mongo
     mongo:
          image: mongo
          restart: always
           ports:
              - "27016:27016"
          volumes:
              - ./storage/mongodb:/data/db
          environment:
              MONGO_INITDB_ROOT_USERNAME: root
              MONGO_INITDB_ROOT_PASSWORD: password
  </code></pre>
  
  <p>While running docker-compose up</p>
  
  <pre><code>chmod: cannot access '/var/www/app/storage': No such file or directory
  ERROR: Service 'web' failed to build: The command '/bin/sh -c chmod -R 
  755 /var/www/app/storage' returned a non-zero code: 1
  </code></pre>
  
  <p>Can anyone suggest to me what I am doing wrong?
  Thanks in advance.</p>