Docker-compose tries to re-install, but has been running for months?

Hello!

I have had Nextcloud running seamlessly using docker-composer without any issues for months; including multiple restarts (physical machine and the containers themselves). However, earlier today, for the first time, I executed sudo docker-compose up before my drive had finished mounting. As a result, Nextcloud now shows an installation screen. This is my yml file:

services:
  nextcloud-db:
    image: postgres:13
    container_name: nextcloud-pg
    restart: unless-stopped
    volumes:
      - ./nextcloud-pg/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=
      - POSTGRES_DB=nextcloud_db
      - POSTGRES_USER=nextcloud_db_user
    networks:
      - nextcloud-net

  nextcloud-redis:
    image: redis:latest
    restart: unless-stopped
    container_name: nextcloud-redis
    volumes:
      - ./nextcloud-redis:/data
    networks:
      - nextcloud-net

  nextcloud-app:
    image: nextcloud:latest
    container_name: nextcloud-app
    restart: unless-stopped
    networks:
      - nextcloud-net
    ports: ["8080:80"]
    environment:
      - POSTGRES_HOST=nextcloud-db
      - POSTGRES_PASSWORD=
      - POSTGRES_DB=nextcloud_db
      - POSTGRES_USER=nextcloud_db_user
    volumes:
      - /media/xx/F/nextcloud/:/var/www/html
    depends_on:
      - nextcloud-db
      - nextcloud-redis

networks:
  nextcloud-net:

I should note that all data appears intact on /media/xx/F/nextcloud/. Gracefully shutting down the containers and restarting my computer followed by mounting and a new docker-compose up does not resolve the issue. I am still presented with the installation screen, despite there clearly being an instance present already.

These are my logs:

Starting nextcloud-pg    ... done
Starting nextcloud-redis ... done
Starting nextcloud-app   ... done
Attaching to nextcloud-pg, nextcloud-redis, nextcloud-app
nextcloud-pg       | 
nextcloud-pg       | PostgreSQL Database directory appears to contain a database; Skipping initialization
nextcloud-pg       | 
nextcloud-pg       | 2022-11-01 22:05:29.740 UTC [1] LOG:  starting PostgreSQL 13.7 (Debian 13.7-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
nextcloud-pg       | 2022-11-01 22:05:29.741 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
nextcloud-pg       | 2022-11-01 22:05:29.741 UTC [1] LOG:  listening on IPv6 address "::", port 5432
nextcloud-pg       | 2022-11-01 22:05:29.748 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
nextcloud-pg       | 2022-11-01 22:05:29.805 UTC [25] LOG:  database system was shut down at 2022-11-01 21:59:28 UTC
nextcloud-pg       | 2022-11-01 22:05:29.833 UTC [1] LOG:  database system is ready to accept connections
nextcloud-redis    | 1:C 01 Nov 2022 22:05:29.614 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
nextcloud-redis    | 1:C 01 Nov 2022 22:05:29.614 # Redis version=7.0.4, bits=64, commit=00000000, modified=0, pid=1, just started
nextcloud-redis    | 1:C 01 Nov 2022 22:05:29.614 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.614 * monotonic clock: POSIX clock_gettime
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.616 * Running mode=standalone, port=6379.
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.616 # Server initialized
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.616 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.617 * Loading RDB produced by version 7.0.4
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.617 * RDB age 361 seconds
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.617 * RDB memory usage when created 0.82 Mb
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.617 * Done loading RDB, keys loaded: 0, keys expired: 0.
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.617 * DB loaded from disk: 0.000 seconds
nextcloud-redis    | 1:M 01 Nov 2022 22:05:29.617 * Ready to accept connections
nextcloud-app      | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.4. Set the 'ServerName' directive globally to suppress this message
nextcloud-app      | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.19.0.4. Set the 'ServerName' directive globally to suppress this message
nextcloud-app      | [Tue Nov 01 22:05:30.386522 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.54 (Debian) PHP/8.0.21 configured -- resuming normal operations
nextcloud-app      | [Tue Nov 01 22:05:30.386568 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
nextcloud-app      | 172.19.0.1 - - [01/Nov/2022:22:05:54 +0000] "GET / HTTP/1.1" 200 2912 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"
nextcloud-app      | 172.19.0.1 - - [01/Nov/2022:22:05:55 +0000] "GET /core/img/background.png?v=2 HTTP/1.1" 200 10137 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"
nextcloud-app      | 172.19.0.1 - - [01/Nov/2022:22:05:55 +0000] "GET /core/img/actions/toggle.svg?v=1 HTTP/1.1" 200 827 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"
nextcloud-app      | 172.19.0.1 - - [01/Nov/2022:22:05:55 +0000] "GET /core/img/actions/info-white.svg?v=2 HTTP/1.1" 200 905 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"
nextcloud-app      | 172.19.0.1 - - [01/Nov/2022:22:05:55 +0000] "GET /core/img/logo/logo.svg?v=1 HTTP/1.1" 200 1334 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"
nextcloud-app      | 172.19.0.1 - - [01/Nov/2022:22:05:55 +0000] "GET /apps/photos/service-worker.js HTTP/1.1" 404 675 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:106.0) Gecko/20100101 Firefox/106.0"
nextcloud-app      | [Tue Nov 01 22:05:59.905097 2022] [autoindex:error] [pid 29] [client 172.19.0.1:58014] AH01276: Cannot serve directory /var/www/html/apps/files/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive

Obviously I would like to return my installation to a usable state and keep all the data as is.

Thanks in advance!

… I should stress that it does not appear as though my config.php file on the persistent volume has been modified. I thought that maybe this was the case, but it does not appear to be the case, after all. That, of course, just makes this situation all the more confusing. Any and all help is greatly appreciated!

Is the mount point clear? Make sure it didn’t get any files created on the accidental run.

If you start a shell on the container, does it have access to the correct data folder?

docker compose exec -itu www-data nextcloud-app /bin/bash
ls /var/www/html/data

Hi Karl

Thanks for your response. Before I do anything I might regret, is it actually safe for me to restart the system in the event that files were indeed created on the accidental run? Also, would I not be able to see any of these on the persistent volume anyway, or am I misunderstanding which files you are referring to?

Thanks!

I’m not in a position to say it’s safe or not, but what I mean is… Normally you use an empty folder as a mount point, but if you don’t have it mounted, maybe some files could have been created in that folder.

What about the directory listing from the container shell?

Hi again

So connecting to the nextcloud-app container as www-data and ls’ing the folder yields:

www-data@d9d4616614cd:/$ ls -al /var/www/html/data
total 20
drwxr-xr-x  2 www-data root     4096 Nov  7 20:36 .
drwxr-xr-x 15 www-data root     4096 Nov  1 21:54 ..
-rw-r--r--  1 www-data www-data  542 Nov  7 20:36 .htaccess
-rw-r--r--  1 www-data www-data    0 Nov  7 20:36 index.html
-rw-r-----  1 www-data www-data 4528 Nov  7 20:36 nextcloud.log

However, I realised what the problem is, and am leaving my solution in case others encounter this issue. As I ran the docker-compose up command just before my drive had actually mounted, Linux created a new folder called F (/xx/media/F) and renamed the old F1. As such, everything technically worked as it should. I simply did not realise that my drive had gotten a new name. I went ahead and unmounted the drive and deleted the newly created F folder, re-mounted the drive and re-registered it as F. Alternatively, I suppose, I could have updated the docker-compose to point to F1 instead of F.

Thanks!

2 Likes

Aha, so I was right about the mount point not being clear. Glad you got it resolved.

1 Like