Docker runs on top of WSL by default, and hence if we have a docker-compose.yaml file that mount local Windows path on docker, e.g. D:\my-big-laravel-project\
A composer install can take forever to complete, some of the steps could even trigger the default process-timeout, while this would not happen if we run composer install natively on Windows terminal.
We suspected it could due to the overhead of mounting Windows directory into Docker WSL, hence what we did is we move my-big-laravel-project to our Ubuntu WSL, e.g. \wsl.localhost\Ubuntu\my-big-laravel-project, configure VSCODE to use WSL remote extension for development.
A run of composer install with docker-compose then just take roughly the same amount of time as native runs.
In short: DON'T MOUNT WINDOWS DIRECTORY WITH DOCKER