How to force update of dbhost value in config.php?

My nextcloud installation originally used a mariadb container that was brought up in the same docker-compose stack at the nextcloud application, so I used to have MYSQL_DATABASE: ‘nclouddb’ in my docker-compose. Now, I have exported and imported the database to a dedicated db system, set up user permissions and see that the credentials do work. I updated the compose file to point towards the db server fqdn, which succesfully resolves from the docker host. Bringing up Nextcloud results in an Internal Server Error, however.

With docker exec --user www-data ncloudapp php occ check I see that: Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/lib/private/DB/Connection.php:85

Well that’s odd, the db server fqdn does resolve just fine, so what gives? After some digging I see that the config.php file in the nextcloud container actually still points towards the old db container and not the new FQDN set in the docker-compose. Why does it not get updated with the new value in my compose file and how do I fix this?

EDIT: I shut down the app container, manually edited the config.php file (despite seeing some warnings online to never do this with Nextcloud Docker) stored in a persistent named volume on the docker host to point to the correct fqdn, brought the app container back up and it works now. So is this a bug? Pretty sure that having MYSQL_DATABASE in docker-compose only work for the original provisioning of the stack but not implementing any later changes into the resultsing config.php is a problem.

I can’t confirm this now but maybe you need to recreate your docker container to adopt new configuration …