NextCloud failed to find MariaDB (Portainer)

Hi,

I installed on the PI OS the “OpenVaultMedia” software, running good so far.

After this I am following the site (https://www.makeuseof.com/raspberry-pi-install-nextcloud-openmediavault-nas/) to setup Nextcloud on OMV. Everything looks fine until the last step (step 6) that is to create admin user account for Nextcloud.

In the nextcloud setup page, for database host, I have tried localhost, mariadb, mariadb-db-1 but none seems to work.

What should I do? Thanks in advance!!

Error for using hostname as localhost

Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory

Error for using mariadb / mariadb-db-1

Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mariadb failed: Try again

Script I used for mariadb

version: '2'

services:
  db:
    image: mariadb:10.5
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes: 
      - /var/lib/docker/volumes/Nextcloud_Database:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=MyPSSWD
      - MYSQL_PASSWORD=MyPSSWD
      - MYSQL_DATABASE=nextclouddatabase
      - MYSQL_USER=nextcloud

Stack:



Container & network setup are as followed:


Based on the Compose entry you posted for your MariaDB container, the name would be db.

But you also appear to be deploying your MariaDB container in a separate stack. This will prevent DNS resolution between the containers. There are multiple solutions, but typically you’d deploy all your Nextcloud related containers together in the same stack (same Compose file).

2 Likes

Tried the first option with “db” filling in the field of “database host” (bottom one)
But didn’t work

& I’m not that familiar with “programming”
Thanks in advance

& by the same compose file, how do you mean to do that?
Are you referring to this list?

don’t know if this is useful to have too: