Nextcloud Docker gives error message after installing

After clicking install in the web page, it reloads and brings me to a black screen that says:

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Below is my docker compose:

services:
  db:
    image: postgres
    restart: always
    volumes:
      - db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
      - POSTGRES_PASSWORD=nextcloud

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    volumes:
      - nextcloud:/var/www/html
    environment:
      - POSTGRES_HOST=db
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
      - POSTGRES_PASSWORD=nextcloud
    depends_on:
      - db

  cron:
    image: nextcloud
    restart: always
    volumes:
      - nextcloud:/var/www/html
    entrypoint: /cron.sh
    depends_on:
      - db

volumes:
  db:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /media/hdd1/nextcloud/db
  nextcloud:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /media/hdd1/nextcloud/www/html

Below are my app and db logs respectively:

Initializing nextcloud 29.0.5.1 ...
New nextcloud instance
Next step: Access your instance to finish the web-based installation!
Hint: You can specify NEXTCLOUD_ADMIN_USER and NEXTCLOUD_ADMIN_PASSWORD and the database variables _prior to first launch_ to fully automate initial installation.
Initializing finished
=> Searching for scripts (*.sh) to run, located in the folder: /docker-entrypoint-hooks.d/before-starting
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.4. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.21.0.4. Set the 'ServerName' directive globally to suppress this message
[Wed Sep 04 21:38:29.041584 2024] [mpm_prefork:notice] [pid 1:tid 1] AH00163: Apache/2.4.61 (Debian) PHP/8.2.22 configured -- resuming normal operations
[Wed Sep 04 21:38:29.041658 2024] [core:notice] [pid 1:tid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
172.21.0.1 - - [04/Sep/2024:21:38:31 +0000] "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1" 200 3263 "https://nc.chabox.me/index.php/apps/files/preview-service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:38:30 +0000] "GET / HTTP/1.1" 200 3267 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:38:29 +0000] "GET / HTTP/1.1" 200 3119 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:38:34 +0000] "GET /core/img/manifest.json HTTP/1.1" 200 740 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:38:35 +0000] "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1" 200 2936 "https://nc.chabox.me/index.php/apps/files/preview-service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:39:17 +0000] "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1" 500 702 "https://nc.chabox.me/index.php/apps/files/preview-service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:38:46 +0000] "POST / HTTP/1.1" 302 1482 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:39:34 +0000] "GET /index.php/core/apps/recommended HTTP/1.1" 500 702 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:39:36 +0000] "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1" 500 702 "https://nc.chabox.me/index.php/apps/files/preview-service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
172.21.0.1 - - [04/Sep/2024:21:40:05 +0000] "GET /index.php/apps/files/preview-service-worker.js HTTP/1.1" 500 702 "https://nc.chabox.me/index.php/apps/files/preview-service-worker.js" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /var/lib/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
    pg_ctl -D /var/lib/postgresql/data -l logfile start
initdb: warning: enabling "trust" authentication for local connections
initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.
waiting for server to start....2024-09-04 21:38:23.406 UTC [47] LOG:  starting PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-09-04 21:38:23.409 UTC [47] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-04 21:38:23.495 UTC [50] LOG:  database system was shut down at 2024-09-04 21:38:20 UTC
2024-09-04 21:38:23.539 UTC [47] LOG:  database system is ready to accept connections
 done
server started
CREATE DATABASE
/usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
waiting for server to shut down....2024-09-04 21:38:24.034 UTC [47] LOG:  received fast shutdown request
2024-09-04 21:38:24.073 UTC [47] LOG:  aborting any active transactions
2024-09-04 21:38:24.084 UTC [47] LOG:  background worker "logical replication launcher" (PID 53) exited with exit code 1
2024-09-04 21:38:24.084 UTC [48] LOG:  shutting down
2024-09-04 21:38:24.101 UTC [48] LOG:  checkpoint starting: shutdown immediate
..........2024-09-04 21:38:34.757 UTC [48] LOG:  checkpoint complete: wrote 922 buffers (5.6%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.054 s, sync=10.466 s, total=10.673 s; sync files=301, longest=0.432 s, average=0.035 s; distance=4255 kB, estimate=4255 kB; lsn=0/1912108, redo lsn=0/1912108
2024-09-04 21:38:34.779 UTC [47] LOG:  database system is shut down
 done
server stopped
PostgreSQL init process complete; ready for start up.
2024-09-04 21:38:35.024 UTC [1] LOG:  starting PostgreSQL 16.4 (Debian 16.4-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2024-09-04 21:38:35.025 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-09-04 21:38:35.025 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2024-09-04 21:38:35.064 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-09-04 21:38:35.122 UTC [63] LOG:  database system was shut down at 2024-09-04 21:38:34 UTC
2024-09-04 21:38:35.186 UTC [1] LOG:  database system is ready to accept connections
2024-09-04 21:39:17.453 UTC [71] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:17.453 UTC [71] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:17.770 UTC [71] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:17.770 UTC [71] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:17.773 UTC [71] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:17.773 UTC [71] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:17.778 UTC [71] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:17.778 UTC [71] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:17.787 UTC [71] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:17.787 UTC [71] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:34.288 UTC [72] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:34.288 UTC [72] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:34.291 UTC [72] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:34.291 UTC [72] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:34.292 UTC [72] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:34.292 UTC [72] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:34.294 UTC [72] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:34.294 UTC [72] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:34.298 UTC [72] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:34.298 UTC [72] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:36.462 UTC [74] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:36.462 UTC [74] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:36.465 UTC [74] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:36.465 UTC [74] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:36.466 UTC [74] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:36.466 UTC [74] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:36.467 UTC [74] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:36.467 UTC [74] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:39:36.470 UTC [74] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:39:36.470 UTC [74] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:40:00.243 UTC [75] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:40:00.243 UTC [75] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:40:00.250 UTC [75] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:40:00.250 UTC [75] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:40:05.311 UTC [76] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:40:05.311 UTC [76] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:40:05.313 UTC [76] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:40:05.313 UTC [76] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:40:05.314 UTC [76] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:40:05.314 UTC [76] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:40:05.316 UTC [76] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:40:05.316 UTC [76] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1
2024-09-04 21:40:05.319 UTC [76] ERROR:  relation "oc_appconfig" does not exist at character 57
2024-09-04 21:40:05.319 UTC [76] STATEMENT:  SELECT "appid", "configkey", "configvalue", "type" FROM "oc_appconfig" WHERE "lazy" = $1

Pull the latest image (29.0.6). This is a bug that was in that release, but it’s since been fixed.

Issue still persists, even when specifying 29.0.6.

Did you remove both your nextcloud and underlying database volumes before retrying? If remnants of the first attempted install are around it will not be a clean install.