How to get access to php.ini file

That is the same conclusion I came up with before reading your post. The added plugins (added after the wordpress image was built) are indeed stored on the file system (see Beginner's Guide to WordPress File and Directory Structure) and will be lost on each “docker compose” run. This same article mentions the following very relevant facts:

Some of these folders may contain important files. Like the gallery folder may contain your gallery images. You should always backup such folders to avoid losing important data.

Other folders may contain files that you can safely delete. For example your caching plugins like W3 Total Cache or WP Super Cache may store cached files in their own folders.

So, my question is this: does the modified docker-compose.yml with added

     volumes:
       - php_data:/var/www/html

cover all cases of modifyng the running containers (adding plugins, themes, etc)?