there are multiple options - you always can use occ command to read and update config.php values. on the other side ususally you want to persist your config.php (and other config files) outside of the container, and for reason you could change the file from the docker host…
Overview of the folders that can be mounted as volumes:
/var/www/html Main folder, needed for updating
/var/www/html/custom_apps installed / modified apps
/var/www/html/config local configuration
/var/www/html/data the actual data of your Nextcloud
The safest and arguably most convenient method is to run occ by invoking php in docker exec. You can set up a bash alias so you can simply type occ (example here). I find this to be a big QOL improvement over the long term.
Alternatively you could also use docker cp to copy out the config, edit, and then copy back in.