Docker PHP container - permissions denied to the vendor directory

When I run composer install inside the PHP app’s container some dependencies from GitHub cannot be written to /vendor directory because of insufficient permissions:
Failed to download php-http/discovery from dist: The “https://api.github.com/repos/php-http/discovery/zipball/theID” file could not be written to /var/www/app/vendor/composer/tmp-theID.zip: Failed to open stream: Permission denied
Now trying to download from source

permissions to vendor: drwxr-xr-x

I’m quite new to docker, and I don’t understand why the user from the docker-compose.yaml is given such permissions to this directory

Thanks in advance!

How about you share your Dockerfile and docker-compose.yml file?