title: Laravel & Docker: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
body: <p>This is my folder structure:</p>
  
  <pre><code>+-- root-app-dir
  |   +-- docker
  |   |   +-- Dockerfile
  |   |   +-- nginx.conf
  |   +-- src // this is where the Laravel app lives
  |   +-- docker-compose.yml
  </code></pre>
  
  <p>This is my <code>docker-compose.yml</code></p>
  
  <pre><code>version: '2'
  
  services:
    app:
      build:
        context: ./docker
        dockerfile: Dockerfile
      image: lykos/laravel
      volumes:
        - ./src/:/var/www/html/
      networks:
        - app-network
  
    nginx:
      image: nginx:latest
      volumes:
        - ./src/:/var/www/html/
        - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
      ports:
        - 8000:80
      networks:
        - app-network
  
    mysql:
      image: mysql:5.7
      ports: 
        - "4306:3306"
      environment:
        MYSQL_DATABASE: homestead
        MYSQL_USER: homestead
        MYSQL_PASSWORD: secret
        MYSQL_ROOT_PASSWORD: secret
      volumes:
        - mysqldata:/var/lib/mysql
      networks:
        - app-network
  
    phpmyadmin:
      image: phpmyadmin/phpmyadmin
      ports:
        - 8080:80
      links:
        - mysql
      environment:
        PMA_HOST: mysql
  
  volumes:
    mysqldata:
      driver: "local"
  
  networks:
    app-network:
      driver: "bridge"
  </code></pre>
  
  <p>This is my nginx.conf</p>
  
  <pre><code>server {
    root /var/www/html/public;
  
    index index.html index.htm index.php;
  
    server_name _;
    charset utf-8;
  
    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt { log_not_found off; access_log off; }
  
    location / {
      try_files $uri $uri/ /index.php$is_args$args;
    }
  
    location ~ \.php$ {
      # include snippets/fastcgi-php.conf;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param PATH_INFO $fastcgi_path_info;
      fastcgi_pass app:9000;
      fastcgi_index index.php;
    }
  
    error_page 404 /index.php;
  
    location ~ /\.ht {
      deny all;
    }
  }
  </code></pre>
  
  <p>When I run <code>docker-compose up -d</code> and try to access the Laravel app through the <code>htts://localhost:8000</code> I get this error on my screen</p>
  
  <pre><code>UnexpectedValueException
  The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
  </code></pre>
  
  <p>I have run <code>sudo chown lykos:lykos -R ./src</code> from my <code>root-app-dir</code> but the issue is still there. How can I fix this?</p>