Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses:

I am trying to install NextCloud on Docker Desktop. I have successfully installed containers for MariaDB and NextCloud but when I continue installation in browser at localhost:8080 I get problems. I enter Username and Password and then get error message:

Error while trying to create admin account: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for nextcloud-db failed: Name or service not known

Mariadb container configuration:

        Container Name: nextcloud-db
        Environment Variables:
            MYSQL_ROOT_PASSWORD: password
            MYSQL_DATABASE: nextcloud
            MYSQL_USER: nextcloud_user
            MYSQL_PASSWORD: password
            Container path /var/lib/mysql.
            Ports: 3308

Nextcloud Container configuration:

        Container Name: nextcloud-app
        Environment Variables:
            MYSQL_DATABASE: nextcloud
            MYSQL_USER: nextcloud_user 
            MYSQL_PASSWORD: password
            MYSQL_HOST: nextcloud-db 
            Container path: var/www/html
            Ports: 8080

I can’t really help with docker-desktop as you post DB and app configuration as different block I guess you created them as separate parts? this way both containers are likely not connected. You either should run all containers from the same compose file or connect all of them to the same network. see docker networking for details

1 Like

Thanx. I solved it by creating a new network in Docker and adding both the the container for MaridDB and Nextcloud

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.