Updating Trusted Domains in Nextcloud Docker

Hi!

When setting up Nextcloud’s docker image for the first time, I only specified my public ip inside NEXTCLOUD_TRUSTED_DOMAINS environment variable for docker-compose.yaml.

I would like to access my Nextcloud GUI from my localhost, so I updated the docker-compose.yaml so that now NEXTCLOUD_TRUSTED_DOMAINS has this value: wonderfuldomain.com 192.168.0.0/16

The problem is that when I run docker-compose up -d --force-recreate, and look inside the config.php, the trusted domains variable is still an array with only one element.

I dont want to go all hacky and install vi inside the docker container to edit the config.php file. Is there a nice way to solve this issue?

Thank you very much for all you do

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
/var/www/html/themes/<YOUR_CUSTOM_THEME> theming/branding

from: GitHub - nextcloud/docker: â›´ Docker image of Nextcloud

It may have vi or nano in it already.

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.

1 Like

Hi! Yes :slight_smile: occ was indeed able to edit that field succesfully. It did’nt fix my issue, but at least I know how to edit the config.php.
Thanks