"File not found error" when installing using composer
Yes, it turns out it was an Nginx configuration problem. In my docker-compose.yml file i have:

web:
  volumes:
    - '/server/path/to/html:/usr/share/nginx/html'

php:
  volumes:
    - '/server/path/to/html:/var/www/html'


In my site.conf file, i had:

fastcgi_param SCRIPT_FILENAME project/$fastcgi_script_name;


Not sure why this worked for the initial php files i tested but then failed during the installation. Changing this line to the full path as follows solved the problem for me:

fastcgi_param SCRIPT_FILENAME /var/www/html/project/$fastcgi_script_name;