Unable to add "trusted_domains" to NextcloudPi docker container

Nextcloud version (eg, 20.0.5):
NextcloudPi version: 1.46.7
Operating system and version (eg, Ubuntu 20.04): Raspbian 10, kernel 5.10.63-v7l+
Apache or nginx version (eg, Apache 2.4.25): Unknown
PHP version (eg, 7.4): Unknown

The issue you are facing:
I am using a docker container for my NextcloudPi server. The command I am using to start the server is the following (if someone could translate this into a docker-compose.yml file for me, I’d hugely appreciate it): docker run -d --restart unless-stopped -p 4443:4443 -p 9443:443 -p 9080:80 -v /mnt/cloud/.docker-data:/data -v /var/www/nextcloud-docker/config:/config --name nextcloudpi-new nextcloudpi-local2 "<website>"

There are a couple of issues I am having with this, one being that the “/config” volume does not seem to be working. But the site as a whole is working when accessing it through the local IP (so I have enabled the “https only” setting, so the port 9080 does not seem to work. I am assuming this is correct and fine. I am also able to connect to the NextcloudPi dashboard with port 4443.

The most annoying issue I am having currently is when adding values to “trusted_domains”. This setting seems to behave completely differently depending on how I add things to it. I have tried adding it inside the “docker run” command, like above. That seems to encode the string into complete gibberish, with letters and numbers which have nothing to do with my domain (or I am assuming it’s an encoded representation, but in either case it does not work). I have tried to access the “config.php” file directly through the terminal to change the string back to the real domain, but that still won’t stay through restarts. If I add a single domain through the “NextcloudPi” dashboard, it seems that is not possible. I get a red light, and nothing is added to the config. It seems that it is required to add three sites on the “trusted_domains” page on NextcloudPi dashboard (which is insane). That adds the strings correctly, but will add redundant (and potentially unsafe) values to the config. Because I am adding two domains which I do not want, to be able to add the one correct domain.

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Setup docker container on RaspberryPi 4
  2. Use ports 9443/9080 for Nextcloud
  3. Include a domain in the “docker run” command, when setting up the container
  4. Access the config.php file and see that the added string is gibberish.

The output of your Nextcloud log in Admin > Logging:

2022-01-22 12:56:35 0 [Note] InnoDB: Uses event mutexes
2022-01-22 12:56:35 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-01-22 12:56:35 0 [Note] InnoDB: Number of pools: 1
2022-01-22 12:56:35 0 [Note] InnoDB: Using generic crc32 instructions
2022-01-22 12:56:35 0 [Note] InnoDB: Initializing buffer pool, total size = 896M, instances = 1, chunk size = 128M
2022-01-22 12:56:36 0 [Note] InnoDB: Completed initialization of buffer pool
2022-01-22 12:56:36 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-01-22 12:56:36 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2022-01-22 12:56:36 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-01-22 12:56:36 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-01-22 12:56:36 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-01-22 12:56:36 0 [Note] InnoDB: 10.3.31 started; log sequence number 182509877; transaction id 446051
2022-01-22 12:56:36 0 [Note] InnoDB: Loading buffer pool(s) from /data/database/ib_buffer_pool
2022-01-22 12:56:36 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-01-22 12:56:36 0 [Note] Server socket created on IP: ''.
2022-01-22 12:56:36 0 [Note] Reading of all Master_info entries succeeded
2022-01-22 12:56:36 0 [Note] Added new Master_info '' to hash table
2022-01-22 12:56:36 0 [Note] mysqld: ready for connections.
Version: '10.3.31-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Debian 10
2022-01-22 12:56:36 0 [Note] InnoDB: Buffer pool(s) load completed at 220122 12:56:36

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "11": "<external-IP>",
            "1": "<docker-IP>",
            "14": "<gibberish>",
            "3": "<gibberish>",
            "6": "",
            "20": "example.ownyourbits.com",
            "21": "example.ownyourbits.org",
            "22": "<website>"
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "",
        "overwrite.cli.url": "https:\/\/<gibberish>\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        "tempdirectory": "\/var\/www\/nextcloud\/data\/tmp",
        "mail_smtpmode": "sendmail",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "overwriteprotocol": "https",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 2,
        "maintenance": false,
        "mail_sendmailmode": "smtp",
        "htaccess.RewriteBase": "\/"

The output of your Apache/nginx/system log in /var/log/____:


Has nobody else had this issue?