title: Container cannot see the prebuilt vendor folder in it
body: <p>My project is throwing the next error after restarting the docker container:<a href="https://i.stack.imgur.com/RHR8p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RHR8p.png" alt="enter image description here" /></a></p>
  <blockquote>
  <p>Warning: require(/var/www/ /var/www/
  /vendor/composer/./symfony/polyfill-php80/bootstrap.php): Failed to
  open stream: No such file or directory in
  'vendor/composer/autoload_real.php line 71</p>
  </blockquote>
  <p>My Dockerfile:</p>
  <pre><code>FROM php:8.0-fpm
  
  # Copy composer.lock and composer.json
  COPY composer.lock composer.json /var/www/project/
  
  # Set working directory
  WORKDIR /var/www/project
  
  # Install dependencies
  RUN apt-get update &amp;&amp; apt-get install -y \
      build-essential \
      libpng-dev \
      libjpeg62-turbo-dev \
      libfreetype6-dev \
      locales \
      zip \
      jpegoptim optipng pngquant gifsicle \
      vim \
      unzip \
      git \
      curl \
      libicu-dev \
      libonig-dev \
      libzip-dev
  # install node
  RUN curl -sL https://deb.nodesource.com/setup_current.x | bash -
  RUN apt-get install -y nodejs
  
  # Clear cache
  RUN apt-get clean &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  # Install extensions
  RUN docker-php-ext-install pdo_mysql zip exif pcntl
  RUN docker-php-ext-configure gd --enable-gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
  RUN docker-php-ext-install gd
  RUN docker-php-ext-configure intl
  RUN docker-php-ext-install intl
  RUN pecl install xdebug &amp;&amp; docker-php-ext-enable xdebug
  RUN echo 'xdebug.client_port=9000' &gt;&gt; /usr/local/etc/php/php.ini
  RUN echo 'xdebug.mode=debug' &gt;&gt; /usr/local/etc/php/php.ini
  RUN echo 'xdebug.discover_client_host=true' &gt;&gt; /usr/local/etc/php/php.ini
  RUN echo 'memory_limit = 4G' &gt;&gt; /usr/local/etc/php/conf.d/docker-php-memlimit.ini;
  
  # 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 permissions
  COPY --chown=www:www . /var/www/project
  
  RUN composer install
  RUN npm install
  RUN npm run dev
  
  RUN php artisan storage:link
  
  ENV PATH=&quot;vendor/bin:${PATH}&quot;
  
  # Change current user to www
  USER www
  
  RUN composer global require tightenco/tlint
  ENV PATH=&quot;${PATH}:/home/www/.composer/vendor/bin&quot;
  
  # Expose port 9000 and start php-fpm server
  EXPOSE 9000
  CMD [&quot;php-fpm&quot;]
  
  </code></pre>
  <p>My docker-compose:</p>
  <pre><code>...
  project:
      build:
        context: ./project/.
        dockerfile: Dockerfile
      image: project:v0
      restart: unless-stopped
      tty: true
      environment:
        PHP_IDE_CONFIG: serverName=docker_project
        XDEBUG_CONFIG: remote_host=172.17.0.1
        SERVICE_NAME: project
        SERVICE_TAGS: dev
      volumes:
        - /var/www/project/vendor/
        - ./project:/var/www/project
        - ./project/.docker/php/local.ini:/usr/local/etc/php/conf.d/local.ini
      networks:
        - project-network
  ...
  </code></pre>
  <p>Inside container run <code>ls vendor/symfony</code> before restarting the container:
  <a href="https://i.stack.imgur.com/EzQxj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EzQxj.png" alt="enter image description here" /></a>
  And after:<a href="https://i.stack.imgur.com/fVFm2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fVFm2.png" alt="enter image description here" /></a></p>
  <p>The error is solving if remove the vendor directory and run <code>composer install</code>.</p>
  <p>I'm not a Jedi of the Docker.</p>
  <p>Thanks for any help/suggestion!</p>