Docker with Laravel = extremely slow

Hi,

I am developing a Laravel website locally and use docker to test it out. The docker runs an Ubuntu image, on a WSL 2 (Windows 11).

When I use standard Docker, the website is extremely slow. Every page refresh is at least 5 seconds or much longer. This apparently is because Docker cannot properly handle the different OS (Windows and Linux).

  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: app-local
    working_dir: /var/www
    volumes:
      - .:/var/www/

I use the above to load the files into the image. This of course is required to sync any changes I do in the Windows environment (Visual Studio Code),

I have managed to significantly speed up things by setting up an rsync:

  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: app-local
    working_dir: /var/www
    volumes:
      - app_data_dpp:/var/www        # Named volume where the project files will be stored
      - ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
      - /d/Web/Code/DPP:/host_project
    networks:
      - app-network
    command: bash -c "while :; do rsync -av --delete --exclude 'vendor/' --exclude 'node_modules/' /host_project/ /var/www/; sleep 2; done & php-fpm"

However, this does only sync the contents from the Windows to the Linux system and not the other way around. As such, any changes I have to do in the Linux system are not reflected in Visual Studio Code.

I am quite amazed that this even is an issue. I cannot see how developers are working with docker for developing sites if this is so slow. I must be doing something wrong or misunderstanding some kind of setting.

I am using Docker Pro, latest version.

Thanks for any pointers!