Composer folder do not synchronize with the host device

Hi guys
I am creating a php docker container.
I need to composer install inside the container and i would like to persist the vendor folder load by composer on the host device.
The composer install well inside the container the vendor folder creates well on the host but nothing inside the folder inside the host vendor folder (container vendor folder contains everything properly).
Do someone has the same problem than me?

Dockerfile

FROM php:7.4-apache-buster

WORKDIR /var/www/src

# Sources
COPY ./src /var/www/src

# Install composer
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
RUN composer install

EXPOSE 80

docker-compose.yml file

version: '3'
services:
  server:
    build:
      context: ./
      dockerfile: ./docker/php/Dockerfile
    volumes:
      - ./src:/var/www/src
      - /var/www/src/vendor

Hi

Thats because when you created the image, as you say the data is there, but when you create a container and map a hosts folder to the same directory, the hosts folder take precedence over the one in the container, meaning that if your hosts /src folder is empty, then it will also be that in the container.