Error while trying to create admin user

I have created a mysql container like so:

docker run --name nextcloud-mysql -e MYSQL_ROOT_PASSWORD=ABC -e MYSQL_DATABASE=nextclouddb -e MYSQL_USER=nextclouduser -e MYSQL_PASSWORD=123 -d mysql:8

I have also created a nextcloud container like so:

docker run -d --network mynetwork --ip --restart unless-stopped nextcloud

In my browser I call up and am greeted by the first run wizard.

I enter the following info:

  • username: admin
  • password: ***


  • database user: nextclouduser
  • database password: 123
  • database name: nextclouddb
  • database host: nextcloud-mysql


Error message:

Error while trying to create admin user: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution

Any help in getting this cleared up would be great.

For anyone in a similar situation. If you look closely to my info above, you will see that I have provided the Nextcloud container with a custom Docker network that I created called “mynetwork”. This is what prevented the mysql container from being accessible since they are now both technically on two different networks:

  • Nextcloud on my “mynetwork” network
  • MySQL on the default Docker network (bridge?)

I put the MySQL container on “mynetwork” and was able to install Nextcloud and get past the first-run wizard.

1 Like