Hello,
I am trying to host nextcloud using docker but I have encountered issues with the initial setup already.
Using the provided docker-compose file (without the volumes and actual env values) from the nextcloud GitHub page fails to connect to DB using Postgres and MariaDB as well.
docker-compose.yml
version: '3.5'
services:
db:
image: postgres
restart: always
container_name: db
environment:
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'secret'
nextcloud:
image: nextcloud
ports:
- 8000:80
depends_on:
- db
restart: always
environment:
POSTGRES_DB: 'nextcloud'
POSTGRES_USER: 'postgres'
POSTGRES_PASSWORD: 'secret'
POSTGRES_HOST: 'db'
NEXTCLOUD_ADMIN_USER: 'admin'
NEXTCLOUD_ADMIN_PASSWORD: 'admin'
Postgres logs:
db | The files belonging to this database system will be owned by user âpostgresâ.
db | This user must also own the server process.
db |
db | The database cluster will be initialized with locale âen_US.utf8â.
db | The default database encoding has accordingly been set to âUTF8â.
db | The default text search configuration will be set to âenglishâ.
db |
db | Data page checksums are disabled.
db |
db | fixing permissions on existing directory /var/lib/postgresql/data ⌠ok
db | creating subdirectories ⌠ok
db | selecting dynamic shared memory implementation ⌠posix
db | selecting default max_connections ⌠100
db | selecting default shared_buffers ⌠128MB
db | selecting default time zone ⌠Etc/UTC
db | creating configuration files ⌠ok
db | running bootstrap script ⌠ok
db | performing post-bootstrap initialization ⌠ok
db | syncing data to disk ⌠ok
db |
db |
db | Success. You can now start the database server using:
db |
db | pg_ctl -D /var/lib/postgresql/data -l logfile start
db |
db | initdb: warning: enabling âtrustâ authentication for local connections
db | You can change this by editing pg_hba.conf or using the option -A, or
db | --auth-local and --auth-host, the next time you run initdb.
db | waiting for server to startâŚ2020-08-27 18:21:27.139 UTC [46] LOG: starting PostgreSQL 12.4 (Debian 12.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db | 2020-08-27 18:21:27.142 UTC [46] LOG: listening on Unix socket â/var/run/postgresql/.s.PGSQL.5432â
db | 2020-08-27 18:21:27.158 UTC [47] LOG: database system was shut down at 2020-08-27 18:21:26 UTC
db | 2020-08-27 18:21:27.163 UTC [46] LOG: database system is ready to accept connections
db | done
db | server started
db |
db | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
db |
db | 2020-08-27 18:21:27.231 UTC [46] LOG: received fast shutdown request
db | waiting for server to shut downâŚ2020-08-27 18:21:27.234 UTC [46] LOG: aborting any active transactions
db | 2020-08-27 18:21:27.237 UTC [46] LOG: background worker âlogical replication launcherâ (PID 53) exited with exit code 1
db | 2020-08-27 18:21:27.237 UTC [48] LOG: shutting down
db | 2020-08-27 18:21:27.253 UTC [46] LOG: database system is shut down
db | done
db | server stopped
db |
db | PostgreSQL init process complete; ready for start up.
db |
db | 2020-08-27 18:21:27.344 UTC [1] LOG: starting PostgreSQL 12.4 (Debian 12.4-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
db | 2020-08-27 18:21:27.344 UTC [1] LOG: listening on IPv4 address â0.0.0.0â, port 5432
db | 2020-08-27 18:21:27.344 UTC [1] LOG: listening on IPv6 address â::â, port 5432
db | 2020-08-27 18:21:27.348 UTC [1] LOG: listening on Unix socket â/var/run/postgresql/.s.PGSQL.5432â
db | 2020-08-27 18:21:27.364 UTC [55] LOG: database system was shut down at 2020-08-27 18:21:27 UTC
db | 2020-08-27 18:21:27.369 UTC [1] LOG: database system is ready to accept connections
Nextcloud logs:
nextcloud_1 | Initializing nextcloud 19.0.1.1 âŚ
nextcloud_1 | Initializing finished
nextcloud_1 | New nextcloud instance
nextcloud_1 | Installing with PostgreSQL database
nextcloud_1 | starting nextcloud installation
nextcloud_1 | PostgreSQL username and/or password not valid
nextcloud_1 | â You need to enter details of an existing account.
nextcloud_1 | retrying installâŚ
nextcloud_1 | An unhandled exception has been thrown:
nextcloud_1 | OC\DatabaseException: An exception occurred while executing âSHOW SERVER_VERSIONâ:
nextcloud_1 |
nextcloud_1 | Failed to connect to the database: An exception occurred in driver: SQLSTATE[08006] [7] could not connect to server: No route to host
nextcloud_1 | Is the server running on host âdbâ (172.30.0.2) and accepting
nextcloud_1 | TCP/IP connections on port 5432? in /var/www/html/lib/private/legacy/OC_DB.php:73
nextcloud_1 | Stack trace:
nextcloud_1 | #0 /var/www/html/lib/private/legacy/OC_DB.php(139): OC_DB::prepare(âSHOW SERVER_VERâŚâ, NULL, NULL)
nextcloud_1 | #1 /var/www/html/lib/private/legacy/OC_Util.php(971): OC_DB::executeAudited(Array)
nextcloud_1 | #2 /var/www/html/lib/private/legacy/OC_Util.php(951): OC_Util::checkDatabaseVersion()
nextcloud_1 | #3 /var/www/html/lib/private/Console/Application.php(161): OC_Util::checkServer(Object(OC\SystemConfig))
nextcloud_1 | #4 /var/www/html/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud_1 | #5 /var/www/html/occ(11): require_once(â/var/www/html/câŚâ)
nextcloud_1 | #6 {main}retrying installâŚ
The retrying goes on until it dies.
Starting the nextcloud with Mariadb connection results in the same issues of not being able to connect to the DB.
nextcloud_1 | Initializing nextcloud 19.0.1.1 âŚ
nextcloud_1 | Initializing finished
nextcloud_1 | New nextcloud instance
nextcloud_1 | Installing with MySQL database
nextcloud_1 | starting nextcloud installation
nextcloud_1 | Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No route to host
nextcloud_1 | â
nextcloud_1 | retrying installâŚ
nextcloud_1 | Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] No route to host
nextcloud_1 | â
nextcloud_1 | retrying installâŚ
No networks here, just a plain setup.