Skip to content

Connection to mariadb dosen't work #1043

@david883

Description

@david883

Hi Guys,
I've been trying to get the Nextcloud image to work in docker for days. Unfortunately the connection to the mariadb does not work. Does anyone have an idea, what am I doing wrong?

Here the docker compose File:

version: '3' 

services:

 db:
    image: mariadb
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    
    container_name: nextcloud-mariadb
    
    
    volumes:
      - db:/var/lib/mysql
      - /etc/localtime:/etc/localtime:ro
    environment:
      MYSQL_ROOT_PASSWORD: passwd
      MYSQL_PASSWORD: passwd2
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
    restart: always
    
  
  app:
    image: nextcloud:latest
    
    expose:
      - 80
      - 443
    links:
      - db
    container_name: nextcloud
    
    depends_on:
      - db
    volumes:
      - nextcloud:/var/www/html
      
    environment:
      VIRTUAL_HOST: nc.xxxxx.de
      LETSENCRYPT_HOST: nc.xxxxx.de
      LETSENCRYPT_EMAIL: xxx@xxx.de
      NEXTCLOUD_ADMIN_USER: Admin
      NEXTCLOUD_ADMIN_PASSWORD: nextcloud
      NEXTCLOUD_TRUSTED_DOMAINS: nc.xxx.de
      MYSQL_PASSWORD: passwd2
      MYSQL_DATABASE: nextcloud
      MYSQL_USER: nextcloud
      MYSQL_HOST: db
    restart: always

volumes:
  nextcloud:
  db:

networks:
    default:
        external:
            name: 

nginx-proxy

Nextcloud and Mariadb Container is created without errors. But nextcloud is not installed automatically. If I look into the logs of the nextcloud container you can see:

`Initializing nextcloud 18.0.2.2 ...

Initializing finished

New nextcloud instance

Installing with MySQL database

starting nextcloud installation

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

->

retrying install...

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

->

retrying install...

Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions