Nextcloud docker-compose not passing environment variables?

Using current package manager Docker on a bare metal Ryzen machine,

I’m using the recommended reverse proxy config for NC from the SWAG container instructions and the Nextcloud initial setup screen keeps appearing despite having set the ncadmin/pass, mariadb root/user/pass and user/pass variables in the NC section of the docker-compose.yaml

They pass through when using NC’s official docker images. Is there a limited set of NC environment variables in the lsio images?

docker-compose.yaml:

version: "2.1"

services:

  swag:
    image: lscr.io/linuxserver/swag:latest
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=998
      - PGID=998
      - TZ=America/Chicago
      - URL=mydomain.com
      - VALIDATION=dns
      - SUBDOMAINS=wildcard
      - DNSPLUGIN=cloudflare
      - EMAIL=admin@mydomain.com
      - ONLY_SUBDOMAINS=false
    volumes:
      - /storage/apps/swag:/config
    ports:
      - 443:443
      - 80:80
    restart: unless-stopped

  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=998
      - PGID=998
      - MYSQL_ROOT_PASSWORD=***********
      - MYSQL_PASSWORD=**********
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - TZ=America/Chicago
    volumes:
      - /storage/apps/mariadb:/config
    ports:
      - 3306:3306
    restart: unless-stopped

  nextcloud:
    image: lscr.io/linuxserver/nextcloud:27.0.0
    container_name: nextcloud
    environment:
      - PUID=998
      - PGID=998
      - TZ=America/Chicago
      - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.mydomain.com nextcloud.my.hopto.org
      - NEXTCLOUD_ADMIN_USER=ncadmin
      - NEXTCLOUD_ADMIN_PASSWORD=*********
      - PHP_UPLOAD_LIMIT=30000M
      - MYSQL_ROOT_PASSWORD=***********
      - MYSQL_PASSWORD=***********
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    volumes:
      - /storage/apps/nextcloud:/config
      - /storage/ncdata:/data
    restart: unless-stopped

Thanks in advance and let me know if i left out pertinent infos

Yea all our ENV’s are listed in the readme. Our nextcloud container is designed to be deployed then configured via the setup wizard.

got it. just stripped out all the USER/PASS env variables from the nextcloud section and set the mariadb variables to exactly match the SWAG setup instructions…

version: "2.1"

services:

  swag:
    image: lscr.io/linuxserver/swag:latest
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=998
      - PGID=998
      - TZ=America/Chicago
      - URL=mydomain.com
      - VALIDATION=dns
      - SUBDOMAINS=wildcard
      - DNSPLUGIN=cloudflare
      - EMAIL=admin@mydomain.com
      - ONLY_SUBDOMAINS=false
    volumes:
      - /storage/apps/swag:/config
    ports:
      - 443:443
      - 80:80
    restart: unless-stopped

  mariadb:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: mariadb
    environment:
      - PUID=998
      - PGID=998
      - MYSQL_ROOT_PASSWORD=*******
      - MYSQL_PASSWORD=*******
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=ncuser
      - TZ=America/Chicago
    volumes:
      - /storage/apps/mariadb:/config
    ports:
      - 3306:3306
    restart: unless-stopped
extcloud:
    image: lscr.io/linuxserver/nextcloud:27.0.0
    container_name: nextcloud
    environment:
      - PUID=998
      - PGID=998
      - TZ=America/Chicago
      - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.mydomain.com nextcloud.my.hopto.org
      - PHP_UPLOAD_LIMIT=30000M
    volumes:
      - /storage/apps/nextcloud:/config
      - /storage/ncdata:/data
    depends_on:
      - mariadb
    restart: unless-stopped

  phpmyadmin:
    image: lscr.io/linuxserver/phpmyadmin:latest
    container_name: phpmyadmin
    environment:
      - PUID=998
      - PGID=998
      - TZ=America/Chicago
      - PMA_ARBITRARY=1 #optional
#      - PMA_ABSOLUTE_URI=https://phpmyadmin.example.com #optional
    volumes:
      - /storage/apps/phpmyadmin:/config
    ports:
      - 8234:80
    restart: unless-stopped

however…

immediately after at dc-up command, i check the resultant mariadb with phpmyadmin and the variables from the mariadb section:

     - MYSQL_DATABASE=nextcloud
     - MYSQL_USER=ncuser

…seemed to have no effect. the nextcloud db and nextcloud user are not showing up in the database.

upon entering all the data in the setup page, i get this error which confirms my suspicions:

are you using portainer or any other UI to deploy? using your compose minus the phpmyadmin bit, i was able to setup nextcloud without issue.

nope, just docker-compose

if you login to mariadb as ncuser and type show databases; do you see nextcloud?

if you login as root and check select user,host from mysql.user do you see ncuser with a host of %?

negative on both queries, just as i saw when viewed with phpmyadmin, only the defaults are there

for some reason, the mariadb env_vars aren’t passing at container startup

what is the output of uname -mr && docker version && docker compose version

~$ uname -mr && docker version && docker compose version
5.10.0-23-amd64 x86_64
Client:
Version: 20.10.5+dfsg1
API version: 1.41
Go version: go1.15.15
Git commit: 55c4c88
Built: Mon May 30 18:34:49 2022
OS/Arch: linux/amd64
Context: default
Experimental: true

Server:
Engine:
Version: 20.10.5+dfsg1
API version: 1.41 (minimum version 1.12)
Go version: go1.15.15
Git commit: 363e9a8
Built: Mon May 30 18:34:49 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.13~ds1
GitCommit: 1.4.13~ds1-1~deb11u4
runc:
Version: 1.0.0~rc93+ds1
GitCommit: 1.0.0~rc93+ds1-5+deb11u2
docker-init:
Version: 0.19.0
GitCommit:
Docker Compose version v2.18.1

Your compose is an up to date version, but docker itself is over 13 months old, I would start by updating it. I did notice you said you use the default package manager’s version, which is obviously super old. We recommend (as do docker themselves) that you install following their instructions
Install Docker Engine | Docker Documentation

I would begin here and see if it resolves the issue. As I mentioned, I copy pasted your compose sections for nextcloud and mariadb and had no issues (you may want to change your passwords though since originally you pasted them)

yeah, while waiting for your suggestion, i saw the 13 month old docker version, went to docker and followed their instructions to nuke everything docker then installed their keys and repo

no joy (although i def see the new docker version)

i’ll step away from this for now to go to some festivities but will pick it back up tomorrow

thanks, as always, for pointing me in the right directions @driz

Just did a down/pull/up and it looks like MDB is not getting the env_var passed

Permissions on the /config and /data local directories belong to uid/gid 998 ‘docker’ and the yaml is launched with it’s group stickybit

Finally found some time to t-shoot this. After deleting the config directories for both nextcloud and mariadb, the env_var pass through and populate the initial nextcloud startup screen.

Must have been some dangling cruft from trying to spin them up with that year-old docker version.

Now to migrate a deluge/sonarr/radar/jackett config from an amlogic S922 box to this machine. Let the breakage continue :wink:

root@server:~# uname -mr && docker version && docker compose version
5.10.0-23-amd64 x86_64
Client: Docker Engine - Community
 Version:           24.0.2
Docker Compose version v2.18.1

Thanks again!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.