Docker issues with a new install - failing to make config persistant across reboots

Steps to reproduce

  1. New install on a remote Debian 10 host
  2. Using docker-compose from the official doc or using a standalone docker install
  3. Bring up the stack first time and everything works fine, reboot and owncloud logs complain of β€œThe username is already being used” and refuses to start (Duplicate of this issue 104 in GitHub for own cloud-docker).
  4. I can get it to start by logging into the MariaDB container and dropping the owncloud database
  5. I was suspecting that I was not linking the volumes from your container to the host properly. I tried with volume as well as the bind mount with the same result.

Observations

  1. The official docs talk about mapping /mnt/data from the container to the local host. When doing that the following 4 folder are mapped to the local host
drwxr-xr-x 2 www-data root 4096 Feb 19 12:50 apps
drwxr-xr-x 2 www-data root 4096 Feb 19 12:50 config
drwxrwx--- 4 www-data root 4096 Feb 19 13:07 files
drwxr-xr-x 2 www-data root 4096 Feb 19 12:52 sessions

The config folder has the following 2 files

-rw-r--r-- 1 www-data root  1038 Feb 19 12:50 objectstore.config.php
-rw-r--r-- 1 www-data root 18749 Feb 19 12:51 overwrite.config.php

What I can’t understand is why is config.php not being mapped to the local host ? I think it is because of this that every time the container restarts it looses its state and wants to create the DB again and therefore throws up the error. The user data on the other hand is persisting across reboots and behaving normally.

I tried doing a standalone install (without docker-compose) with the same result. The config.php is only on the container and not mapped to the local host. Every reboot I have to edit it to add the trusted_domains.

Anyone has any clues ?

Note:

Below docker-compose shows bind mounts, I am getting the same result for volumes also.

version: "3.6"

services:
  owncloud:
    image: owncloud/server:${OWNCLOUD_VERSION}
    container_name: owncloud_server
    restart: always
    ports:
      - ${HTTP_PORT}:8080
    depends_on:
      - mariadb
      - redis
    environment:
      - OWNCLOUD_DOMAIN=${OWNCLOUD_DOMAIN}
      - OWNCLOUD_TRUSTED_DOMAINS=${OWNCLOUD_TRUSTED_DOMAINS}
      - OWNCLOUD_DB_TYPE=mysql
      - OWNCLOUD_DB_NAME=owncloud
      - OWNCLOUD_DB_USERNAME=owncloud
      - OWNCLOUD_DB_PASSWORD=owncloud
      - OWNCLOUD_DB_HOST=mariadb
      - OWNCLOUD_MYSQL_UTF8MB4=true
      - OWNCLOUD_REDIS_ENABLED=true
      - OWNCLOUD_REDIS_HOST=redis
    healthcheck:
      test: ["CMD", "/usr/bin/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 5
    volumes:
      - type: bind 
        source: /mnt/oc
        target: /mnt/data

  mariadb:
    image: mariadb:10.6 # minimum required ownCloud version is 10.9
    container_name: owncloud_mariadb
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=owncloud
      - MYSQL_USER=owncloud
      - MYSQL_PASSWORD=owncloud
      - MYSQL_DATABASE=owncloud
    command: ["--max-allowed-packet=128M", "--innodb-log-file-size=64M"]
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-u", "root", "--password=owncloud"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - type: bind
        source: /mnt/mariadb
        target: /var/lib/mysql

  redis:
    image: redis:6
    container_name: owncloud_redis
    restart: always
    command: ["--databases", "1"]
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - type: bind
        source: /mnt/redis
        target: /data

Server configuration

Debian 10 LXC on a promox machine. The container is running in privellaged mode with nesting on.

Database:
MariaDB10.6

ownCloud version: (see ownCloud admin page)
owncloud/server:latest 10.11

Updated from an older ownCloud or fresh install:
Fresh Install

Where did you install ownCloud from:
Official docs for docker-compose

Hello,

The problem is that we have never been able to reproduce it, which makes troubleshooting quite difficult. I am also not able to reproduce it with your compose file. The DB and initial ownCloud setup is done on first startup, and I am able to restart the compose stack many times without issue.

What I can’t understand is why is config.php not being mapped to the local host

That’s something I can’t reproduce as well. After the first start, the bind mount looks like this:

❯ sudo tree /tmp/oc
/tmp/oc
β”œβ”€β”€ apps
β”œβ”€β”€ config
β”‚   β”œβ”€β”€ config.php
β”‚   β”œβ”€β”€ objectstore.config.php
β”‚   └── overwrite.config.php
β”œβ”€β”€ files
β”‚   β”œβ”€β”€ index.html
β”‚   └── owncloud.log
└── sessions
    β”œβ”€β”€ sess_184q9s6863hcm78hnootb0dn1s
    └── sess_4obhfcaa47rhq18ub025r3jc5o

Every reboot I have to edit it to add the trusted_domains.

Never touch the config.php file or any other default config file in the config directory manually. Those files are handled by the container. Use the provided environment variables (recommended) or mount your own config file. For more details, see my post at You are accessing the server from an untrusted domain - #10 by rkaussow

1 Like

Thank you for sharing and checking this !

On my LXC container running Debian 10 (privileged mode on nesting on), I see the following.

root@whip:~/owncloud# tree /mnt/oc/
/mnt/oc/
|-- apps
|-- config
|   |-- objectstore.config.php
|   `-- overwrite.config.php
|-- files
|   |-- index.html
|   `-- owncloud.log
`-- sessions

4 directories, 4 files

The same docker compose on a ubuntu server 22.04 host reports a correct behaviour.

sammy@ghoul:/mnt$ sudo tree /mnt/oc/
/mnt/oc/
β”œβ”€β”€ apps
β”œβ”€β”€ config
β”‚   β”œβ”€β”€ config.php
β”‚   β”œβ”€β”€ objectstore.config.php
β”‚   └── overwrite.config.php
β”œβ”€β”€ files
β”‚   β”œβ”€β”€ index.html
β”‚   └── owncloud.log
└── sessions

4 directories, 5 files
sammy@ghoul:/mnt$

The difference between the 2 scenarios is the LXC container is running with root privileges, while the ubuntu server has a user account. I will try to create a user in the LXC and then install docker & then owncloud to see if the behaviour persists. Otherwise safe to say that it’s the LXC container that is messing up the install.

Interesting… I would still be interested in why this is causing problems on LXC. If you find anything, please keep us posted. As I also use Proxmox for my private setup, I will try to find some time to test this as well.

On a fresh LXC install with docker installed as a user, it works correctly. Please let me know if you see the same behaviour.

sammy@whip2:~/owncloud$ tree /mnt/oc/
/mnt/oc/
|-- apps
|-- config
|   |-- config.php
|   |-- objectstore.config.php
|   `-- overwrite.config.php
|-- files [error opening dir]
`-- sessions
    `-- sess_ql18bhslc55im4le3bu8uq0aur

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