title: Docker Laravel - could not be opened in append mode: failed to open stream: Permission denied
body: <p>Have been trying to fix this error for almost an entire day now and have no idea what is possibly causing this issue.</p>
  <p>The error I get is: UnexpectedValueException
  The stream or file &quot;/var/www/storage/logs/laravel.log&quot; could not be opened in append mode: failed to open stream: Permission denied</p>
  <p>Below are my docker-compose.yml, Dockerfile and conf.d files.</p>
  <p>docker-compose.yml:</p>
  <pre><code>version: &quot;3&quot;
  services:
    app:
      build:
        context: .
        dockerfile: Dockerfile
      image: /laravelproject
      container_name: app
      restart: unless-stopped
      volumes:
        - ./:/var/www
        - ./config/php/local.ini:/usr/local/etc/php/conf.d/local.ini
  
    webserver:
      build:
        context: .
        dockerfile: Dockerfile_Nginx
      image: /nginx
      container_name: webserver
      restart: unless-stopped
      ports:
        - &quot;8080:80&quot;
      volumes:
        - ./:/var/www
        - ./config/nginx/conf.d/:/etc/nginx/conf.d/
      depends_on:
        - app
  </code></pre>
  <p>Dockerfile:</p>
  <pre><code>FROM php:7.3-fpm-alpine
  
  WORKDIR /var/www
  
  RUN apk update &amp;&amp; apk add \
      build-base \
      freetype-dev \
      libjpeg-turbo-dev \
      libpng-dev \
      libzip-dev \
      zip \
      jpegoptim optipng pngquant gifsicle \
      vim \
      unzip \
      git \
      curl
  
  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
  
  # copy config
  COPY ./config/php/local.ini /usr/local/etc/php/conf.d/local.ini
  
  RUN addgroup -g 1000 -S www &amp;&amp; \
      adduser -u 1000 -S www -G www
  
  USER www
  
  COPY --chown=www-data:www-data . /var/www
  
  EXPOSE 9000
  </code></pre>
  <p>app.conf:</p>
  <pre><code>server{
      listen 80;
      index index.php index.html;
      error_log  /var/log/nginx/error.log;
      access_log /var/log/nginx/access.log;
      root /var/www/public;
      location ~ \.php$ {
          try_files $uri =404;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass app:9000;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
      }
      location / {
          try_files $uri $uri/ /index.php?$query_string;
          gzip_static on;
      }
  }
  </code></pre>
  <p>I have tried many solutions but none of them have worked.</p>
  <p>Thanks.</p>