Repository navigation
Description
Hello, I have recently modified the port mapping for my Nextcloud container, so I restarted the NC container and since then it is unable to connect to the MySQL DB.
OS: Debian GNU/Linux 8 (jessie)
NC container logs:
PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again in /config/www/nextcloud/lib/private/DB/Connection.php:64
Stack trace:
#0 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()
#1 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /config/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /config/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array in /config/www/nextcloud/lib/private/DB/Connection.php on line 64
My config file:
<?php
$CONFIG = array (
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'redis',
'port' => 6379,
),
'datadirectory' => '/data',
'instanceid' => 'ocq371i1672w',
'passwordsalt' => '',
'secret' => '',
'trusted_domains' =>
array (
0 => '192.168.0.66'
),
'overwrite.cli.url' => 'https://192.168.0.66',
'dbtype' => 'mysql',
'version' => '15.0.2.0',
'dbname' => 'nextcloud',
'dbhost' => 'mysql',
'dbport' => '3306',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_admin2',
'dbpassword' => '',
'installed' => true,
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'mail_from_address' => '',
'mail_smtpmode' => 'smtp',
'mail_domain' => 'gmail.com',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => 'smtp.gmail.com',
'mail_smtpport' => '465',
'mail_smtpname' => '',
'mail_smtppassword' => '',
'mail_smtpsecure' => 'ssl',
);
I linked the NC container to the DB container using --link mysqldb:mysql where mysqldb is the name of the mysql container. I have checked that the DB container is up and running and I am able to ping it from the NC container.
Any help is appreciated

Activity
j0nnymoe commentedon Feb 2, 2019
Link is being deprecated in docker, it's best to use docker networking to link containers these days.
ordinaly commentedon Feb 2, 2019
I tried to set up a macvlan network but I didn't figure out how to access the container from the browser once it is attached to the network ?
I also tried to fire up a docker-compose but ran into the same issue
homerr commentedon Feb 27, 2019
Not sure about macvlan in docker, as this should be internal networking on the docker host unless you're attempting to use a remote SQL instance?
Some more information would be appreciated here, your docker run/compose.yml files and how you are trying to do this. We might be able to figure this one out for you then.
thelamer commentedon Mar 1, 2019
@gaussianblurs for stuff like this it is much easier to help you out on Discord. As this is not a bug specific to this container or a change we can make in the codebase as we have multiple users connecting Nextcloud up to MySQL please hop in here and we can help you out:
https://discord.gg/YWrKVTn