title: Getting RuntimeException: A facade root has not been set. in /var/www/html/vendor/.../Illuminate/Support/Facades/Facade.php
body: <p>I am trying to setup the PHP, MYSQL, NGINX using Docker . I followed the udemy tutorial by Maximillian and
  my kept all my docker files in a dockerfiles folder.</p>
  <p>The php.dockerfile is as follows:</p>
  <pre><code>FROM php:8.0-fpm-alpine
  
  WORKDIR /var/www/html
  
  COPY src .
  
  RUN docker-php-ext-install pdo pdo_mysql
  
  </code></pre>
  <p>My nginx.dockerfile is :</p>
  <pre><code>FROM nginx:stable-alpine
  
  WORKDIR /etc/nginx/conf.d
  
  COPY nginx/nginx.conf .
  
  RUN mv nginx.conf default.conf
  
  WORKDIR /var/www/html
  
  COPY src .
  
  </code></pre>
  <p>And composer file is:</p>
  <pre><code>FROM composer:latest
   
  WORKDIR /var/www/html
   
  ENTRYPOINT [ &quot;composer&quot; ]
  
  </code></pre>
  <p>The docker-compose.yaml file is :</p>
  <pre><code>version: '2.2'
  
  services:
    server:
      # image: 'nginx:stable-alpine'
      build:
        context: .
        dockerfile: dockerfiles/nginx.dockerfile
      ports:
        - '8000:80'
      volumes:
        - ./src:/var/www/html
        - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
      # depends_on:
      #   - php
      #   - mysql
    php:
      build:
        context: .
        dockerfile: dockerfiles/php.dockerfile
      volumes:
        - ./src:/var/www/html:delegated
    mysql:
      image: mysql:5.7
      env_file:
        - ./env/mysql.env
    composer:
      build:
        context: ./dockerfiles
        dockerfile: composer.dockerfile
      volumes:
        - ./src:/var/www/html
    artisan:
      build:
        context: .
        dockerfile: dockerfiles/php.dockerfile
      volumes:
        - ./src:/var/www/html
      entrypoint: ['php', '/var/www/html/artisan']
    npm:
      image: node:14
      working_dir: /var/www/html
      entrypoint: ['npm']
      volumes:
        - ./src:/var/www/html
  
  
  </code></pre>
  <p>nginx.conf file is :</p>
  <pre><code>server {
      listen 80;
      index index.php index.html;
      server_name localhost;
      root /var/www/html/public;
      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
      location ~ \.php$ {
          try_files $uri =404;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass php:9000;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
      }
  }
  
  </code></pre>
  <p>But When I run the following command :</p>
  <pre><code>docker-compose up --build server php mysql
  
  </code></pre>
  <p>After the command :</p>
  <pre><code>
  docker-compose run --rm composer create-project --prefer-dist laravel/laravel .
  
  </code></pre>
  <p>I get this Facade error . I went through all the Questions in stack over flow that has this error but I couldn't find the resolution even after hours of searching as I am new to both docker and PHP. Please help me setting up this application. Error screenshot is as follows :</p>
  <p><a href="https://i.stack.imgur.com/Ul9QZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ul9QZ.png" alt="A facade root has not been set" /></a></p>