Nextcloud cannot connect to MySQL [Docker]

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.
Here is the output of the logs:

PHP message: 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/3rd

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 tha name of the mysql container

I am able to ping the MySQL server from the NC container using ping mysql:3306

Any help is appreciated

I think I get sort of the same error, but with an native installation.
PHP 7.0.32-0ubuntu0.16.04.1 (cli) ( NTS )
VERSION=“16.04.5 LTS (Xenial Xerus)”
Server version: Apache/2.4.18 (Ubuntu)

<?php
$CONFIG = array (
  'instanceid' => 'ocvcjhfgjk',
  'passwordsalt' => 'fgfdhgj',
  'secret' => 'fgfgfgfgfgfg',
  'trusted_domains' =>
  array (
    0 => 'someDomain.com',
  ),
  'datadirectory' => '/media/sdb1/nextcloud/data/data',
  'overwrite.cli.url' => 'someDomain.com',
  'dbtype' => 'mysql',
  'version' => '15.0.2.0',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => 'password',
  'logtimezone' => 'UTC',
  'installed' => true,
  'updater.release.channel' => 'stable',
  'ldapIgnoreNamingRules' => false,
  'appstore.experimental.enabled' => true,
  'loglevel' => 3,
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'log_rotate_size' => '104857600',
  'mail_smtpmode' => 'smtp',
  'maintenance' => false,
  'ldapProviderFactory' => '\\OCA\\User_LDAP\\LDAPProviderFactory',
  'mail_from_address' => 'nextcloud',
  'mail_domain' => 'someDomain.com',
  'mail_smtphost' => 'mailserver.com',
  'mail_smtpport' => '25',
  'enable_avatars' => true,
  'integrity.check.disabled' => true,
  'theme' => '',
  'updater.secret' => 'fdfghgjjdgd',
);

[Mon Feb 04 06:25:02.553695 2019] [mpm_prefork:notice] [pid 3321] AH00163: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g configured -- resuming normal operations
[Mon Feb 04 06:25:02.553712 2019] [core:notice] [pid 3321] AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 04 12:50:28.774891 2019] [:error] [pid 6490] [client 194.76.156.20:54829] PHP Fatal error:  Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\\DB\\Connection->connect()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\\DBAL\\Connection->getDatabasePlatformVersion()\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\\DBAL\\Connection->detectDatabasePlatform()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\\DBAL\\Connection->getDatabasePlatform()\n#4 /var/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__construct(Array, Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Obj in /var/www/nextcloud/lib/private/DB/Connection.php on line 64
[Mon Feb 04 12:50:28.775195 2019] [:error] [pid 6490] [client 194.76.156.20:54829] PHP Fatal error:  Uncaught Doctrine\\DBAL\\DBALException: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory in /var/www/nextcloud/lib/private/DB/Connection.php:64\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\\DB\\Connection->connect()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\\DBAL\\Connection->getDatabasePlatformVersion()\n#2 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\\DBAL\\Connection->detectDatabasePlatform()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\\DBAL\\Connection->getDatabasePlatform()\n#4 /var/www/nextcloud/lib/private/DB/Connection.php(151): Doctrine\\DBAL\\Connection->setTransactionIsolation(2)\n#5 /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\\DB\\Connection->__construct(Array, Object(Doctrine\\DBAL\\Driver\\PDOMySql\\Driver), Obj in /var/www/nextcloud/lib/private/DB/Connection.php on line 64

EDIT: It seems that files smaller than 1MB are fine in uploading… @Gaussian can you approve that?