NextCloud - Funky Penguin's Geek Cookbook

OK, I think what we’re seeing here might be an interaction between the env variables used for the database backup container, and the built-in env variables mysql/mariadb uses.

I just confirmed this simple example is working

services:
  nextcloud:
    image: nextcloud
    env_file: /var/data/config/nextcloud/nextcloud-dbtest.env
    networks:
      - internal
      - traefik_public
    deploy:
      labels:
        - traefik.frontend.rule=Host:nextcloud-dbtest.funkypenguin.co.nz
        - traefik.docker.network=traefik_public
        - traefik.port=80
    volumes:
      - /var/data/nextcloud-dbtest/:/var/www/html
      - /var/data/nextcloud-dbtest/apps:/var/www/html/custom_apps
      - /var/data/nextcloud-dbtest/config:/var/www/html/config
      - /var/data/nextcloud-dbtest/data:/var/www/html/data

  db:
    image: mariadb:10
    env_file: /var/data/config/nextcloud/nextcloud-dbtest.env
    networks:
      - internal
    volumes:
      - /var/data/runtime/nextcloud-dbtest/db:/var/lib/mysql

With env file:

[root@ds1 nextcloud]# cat nextcloud-dbtest.env
DB_TYPE=mysql
DB_NAME=nextcloud
DB_USER=nextcloud
DB_PASSWORD=nextcloud
DB_HOST=db

# For mysql
MYSQL_ROOT_PASSWORD=batman
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud
MYSQL_PASSWORD=nextcloud

Can you try stripping out the last 5 lines of the env file per the recipe (starting with # For database backup), and see whether this works? You may need to delete the contents of /var/data/runtime/nextcloud/db/ to force MariaDB to recreate them.

D