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 192.168.1.227 --restart unless-stopped nextcloud
In my browser I call up 192.168.1.227 and am greeted by the first run wizard.
I enter the following info:
- username: admin
- password: ***
MySQL/MariaDB:
- database user: nextclouduser
- database password: 123
- database name: nextclouddb
- database host: nextcloud-mysql
Result:
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.
CodePudding user response:
Your nextcloud-mysql
and nextcloud
containers in different networks. Mysql I think in network bridge
, nextcloud app in network mynetwork
You need to make both containers are on same network, add same network parameters to command for mysql containers as for application.example: --network mynetwork --ip 192.168.1.228
I think that mynetwork
is your physical network and I'm not sure that docker can correctly resolve name nextcloud-mysql
in your case, You may need to write IP address a database in application config.