NEXTCLOUD_TRUSTED_DOMAINS funktioniert nicht wie beschrieben

Moin,

ich setze einen Dockercontainer von Nextcloud mit folgendem Befehl auf:

docker run \
--name nextcloud_test \
-p 8080:80 \
-v ~/docker/nextcloud_test/nextcloud-data:/var/www/html \
-e NEXTCLOUD_ADMIN_USER=admin \
-e NEXTCLOUD_ADMIN_PASSWORD=admin \
-e NEXTCLOUD_TRUSTED_DOMAINS=0.0.0.0 imac.local 10.0.1.140 \
-d nextcloud:latest

Laut der Anleitung von hier GitHub - nextcloud/docker: ⛴ Docker image of Nextcloud soll man die Domains mit Leerzeichen separiert angeben:

  • NEXTCLOUD_TRUSTED_DOMAINS (not set by default) Optional space-separated list of domains

Leider funktioniert das nicht. Ich erhalte folgende Fehlermeldung:

Unable to find image 'imac.local:latest' locally
docker: Error response from daemon: pull access denied for imac.local, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.

Ich habe auch nachstehende Varianten probiert (alle drei hintereinander):

-e NEXTCLOUD_TRUSTED_DOMAINS=0.0.0.0 \
-e NEXTCLOUD_TRUSTED_DOMAINS=imac.local \
-e NEXTCLOUD_TRUSTED_DOMAINS=10.0.1.140 \

Oder einzeln in ’ oder ":
-e NEXTCLOUD_TRUSTED_DOMAINS="0.0.0.0" "imac.local" "10.0.1.140" \

-e NEXTCLOUD_TRUSTED_DOMAINS='0.0.0.0' 'imac.local' '10.0.1.140' \

In beiden Fällen bekomme ich die obige Fehlermeldung.

Dann habe ich den Gesamtstring in ’ und die Einzelwerte in " eingefasst – und umgekehrt:

-e NEXTCLOUD_TRUSTED_DOMAINS='"0.0.0.0" "imac.local" "10.0.1.140"' \

-e NEXTCLOUD_TRUSTED_DOMAINS="'0.0.0.0' 'imac.local' '10.0.1.140'" \

In diesem Fall wird keiner der Werte übernommen. Dasselbe erhält man, wenn man den Gesamtstring einmal in " oder in ’ einfasst:

-e NEXTCLOUD_TRUSTED_DOMAINS="0.0.0.0 imac.local 10.0.1.140" \

-e NEXTCLOUD_TRUSTED_DOMAINS='0.0.0.0 imac.local 10.0.1.140' \

Nichts von dem funktioniert.

Hat jemand eine Idee?

Moin auch,

sieht ja ganz danach aus als ob die Variable nicht korrekt interpretiert wird.

How ever, ich würde das in der Start Syntax weglassen. Du hast ja sowieso schon ein Volume auf /var/www/html gesetzt dann kannst Du dort auch nach dem Start die benötigten Werte in der config.php modifizieren ohne dass diese beim Container Neustart verlustisch gehen…

Hi all,

Today I’ve encountered the same problem while setting up NextCloud via docker containers (docker-compose)

    version: '3.7'

    networks:
      nextcloud:

    services:
      db:
        image: mariadb:latest
        command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
        container_name: mariadb
        networks:
          - nextcloud
        restart: always
        expose:
          - 3306
        volumes:
          - ./db:/var/lib/mysql
        environment:
          - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
          - MYSQL_DATABASE_FILE=/run/secrets/mysql_database
          - MYSQL_USER_FILE=/run/secrets/mysql_user
          - MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
        secrets:
          - mysql_root_password
          - mysql_database
          - mysql_user
          - mysql_password

      app:
        image: nextcloud
        container_name: nextcloud
        networks:
          - nextcloud
        restart: always
        ports:
          - 80:80
        volumes:
          - ./nextcloud:/var/www/html
        environment:
          - MYSQL_HOST=db
          - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
          - MYSQL_DATABASE_FILE=/run/secrets/mysql_database
          - MYSQL_USER_FILE=/run/secrets/mysql_user
          - MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
          - NEXTCLOUD_ADMIN_PASSWORD_FILE=/run/secrets/nextcloud_admin_password
          - NEXTCLOUD_ADMIN_USER_FILE=/run/secrets/nextcloud_admin_user
          - NEXTCLOUD_TRUSTED_DOMAINS_FILE=/run/secrets/nextcloud_trusted_domains
        depends_on:
          - db
        secrets:
          - nextcloud_admin_password
          - nextcloud_admin_user
          - mysql_root_password
          - mysql_database
          - mysql_user
          - mysql_password
          - nextcloud_trusted_domains


    secrets:
      nextcloud_admin_password:
        file: ./nextcloud_admin_password.txt
      nextcloud_admin_user:
        file: ./nextcloud_admin_user.txt
      mysql_database:
        file: ./mysql_database.txt
      mysql_root_password:
        file: ./mysql_root_password.txt
      mysql_password:
        file: ./mysql_password.txt
      mysql_user:
        file: ./mysql_user.txt
      nextcloud_trusted_domains:
        file: ./nextcloud_trusted_domains.txt

Note: I’ve left out the part of the reverse proxy to incorporate SSL since it is not relevant and makes it more complicated to follow. Of course, you need to provide the correct info (passwords and such) in the secret files. but for some reason, the trusted domains in the “nextcloud_trusted_domains.txt” file are not set. To be clear, all the other parameters from the secrets are set correctly.

I think the autoconfig.php is missing the code to process the domain setting.

what I did after starting the containers is manually adding the trusted domains in the config.php file
by running the following command:

docker exec --user www-data nextcloud php occ config:system:set trusted_domains 1 --value trusted_domain-ip/or/FQDN

this resulted in an addition to the /nextcloud/config/config.php file as follows:

trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'my-trusted-domain-ip/or/FQDN',
  )

after this addition, everything worked perfectly.
So this does make me believe that there is a bug in parsing the env variables. I think the code for the trusted domain variable is missing or broken.

If I find the time I might go looking into it and fix the image but since it’s working this way, I might not get to it.
I hope this info helps other users.

greetings,

Mario

1 Like