Like the problems I was having with Docker timeouts, I recently had problems on my slow home Internet getting PHP’s composer to build the assets for a project.
The error message contained “exceeded the timeout of 300 seconds” so it was easy to identify.
The fix, run from the terminal was:
export COMPOSER_PROCESS_TIMEOUT=1500
Where the number is the number of seconds before a composer operation timesout. This fix is temporary, for a permanent solution have a look at how to make environment variables persist.