I did upgrade NC from v28 to v29 on docker. After the image upgrade, the application fails with “Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for db failed: Name or service not known”
The database is running according to the docker logs. This is the docker-compose.yaml that I use:
nextclouddb:
container_name: nextclouddb
image: mariadb:10.6
command: --skip-innodb-read-only-compressed --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- ./volumes/nextclouddb_mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=xxxxx
- MYSQL_PASSWORD=yyyyyy
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
labels:
- "com.centurylinklabs.watchtower.enable=true"
nextcloud:
container_name: nextcloud
image: nextcloud:29
restart: always
ports:
- 127.0.0.1:8085:80
depends_on:
- nextclouddb
links:
- nextclouddb:db
volumes:
- ./volumes/nextcloud:/var/www/html
environment:
- MQSQL_HOST=db
- MYSQL_PASSWORD=yyyyyy
- MYSQL_DATABASE=nextcloud
- MYSQL_USER=nextcloud
labels:
- "com.centurylinklabs.watchtower.enable=true"
The Basics
- Nextcloud Server version (e.g., 29.x.x):
- 29.0.10
- Operating system and version (e.g., Ubuntu 24.04):
- Debian 11.11 x64
- Web server and version (e.g, Apache 2.4.25):
- from docker image 29.0.10
- Reverse proxy and version _(e.g. nginx 1.27.2)
- from docker NC image 29.0.10
- PHP version (e.g, 8.3):
- 8.2.26
- Is this the first time you’ve seen this error? (Yes / No):
- Yes
- When did this problem seem to first start?
- After docker container update from NC28 to NC 29.0.10
- Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
- Docker
- Are you using CloudfIare, mod_security, or similar? (Yes / No)
- No
Summary of the issue you are facing:
See above
Steps to replicate it (hint: details matter!):
- Change docker image version from nextcloud:28 to nextcloud:29
- Recreate container
Log entries
Nextcloud
Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your nextcloud.log
located in your data directory). Feel free to use a pastebin/gist service if necessary.
{
"reqId": "wmZOS68FdTtAQqVVCx3u",
"level": 3,
"time": "2024-12-11T19:15:19+00:00",
"remoteAddr": "217.247.97.12",
"user": "--",
"app": "core",
"method": "GET",
"url": "/index.php/204",
"message": "Exception thrown: Doctrine\\DBAL\\Exception",
"userAgent": "Mozilla/5.0 (Windows) mirall/3.15.0stable-Win64 (build 20241125) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)",
"version": "28.0.13.1",
"exception": {
"Exception": "Doctrine\\DBAL\\Exception",
"Message": "Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for db failed: Name or service not known",
"Code": 2002,
"Trace": [{
"file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
"line": 453,
"function": "connect",
"class": "OC\\DB\\Connection",
"type": "->",
"args": []
}, {
"file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
"line": 411,
"function": "getDatabasePlatformVersion",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": []
}, {
"file": "/var/www/html/3rdparty/doctrine/dbal/src/Connection.php",
"line": 318,
"function": "detectDatabasePlatform",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": []
}, {
"file": "/var/www/html/lib/private/DB/ConnectionAdapter.php",
"line": 200,
"function": "getDatabasePlatform",
"class": "Doctrine\\DBAL\\Connection",
"type": "->",
"args": []
}, {
"file": "/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php",
"line": 121,
"function": "getDatabasePlatform",
"class": "OC\\DB\\ConnectionAdapter",
"type": "->",
"args": []
}, {
"file": "/var/www/html/lib/private/AppConfig.php",
"line": 1239,
"function": "expr",
"class": "OC\\DB\\QueryBuilder\\QueryBuilder",
"type": "->",
"args": []
}, {
"file": "/var/www/html/lib/private/AppConfig.php",
"line": 264,
"function": "loadConfig",
"class": "OC\\AppConfig",
"type": "->",
"args": [false]
}, {
"file": "/var/www/html/lib/private/legacy/OC_App.php",
"line": 736,
"function": "searchValues",
"class": "OC\\AppConfig",
"type": "->",
"args": ["installed_version"]
}, {
"file": "/var/www/html/lib/private/TemplateLayout.php",
"line": 230,
"function": "getAppVersions",
"class": "OC_App",
"type": "::",
"args": []
}, {
"file": "/var/www/html/lib/private/legacy/OC_Template.php",
"line": 145,
"function": "__construct",
"class": "OC\\TemplateLayout",
"type": "->",
"args": ["error", ""]
}, {
"file": "/var/www/html/lib/private/Template/Base.php",
"line": 132,
"function": "fetchPage",
"class": "OC_Template",
"type": "->",
"args": []
}, {
"file": "/var/www/html/lib/private/legacy/OC_Template.php",
"line": 320,
"function": "printPage",
"class": "OC\\Template\\Base",
"type": "->",
"args": []
}, {
"file": "/var/www/html/index.php",
"line": 114,
"function": "printExceptionErrorPage",
"class": "OC_Template",
"type": "::",
"args": [{
"__class__": "Doctrine\\DBAL\\Exception"
}, 500]
}
],
"File": "/var/www/html/lib/private/DB/Connection.php",
"Line": 167,
"CustomMessage": "Exception thrown: Doctrine\\DBAL\\Exception"
}
}
Web Browser
If the problem is related to the Web interface, open your browser inspector Console and Network tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.
PASTE
Web server / Reverse Proxy
The output of your Apache/nginx/system log in /var/log/____
:
PASTE HERE
Configuration
Nextcloud
The output of occ config:list system
or similar is best, but, if not possible, the contents of your config.php
file from /path/to/nextcloud
is fine (make sure to remove any identifiable information!):
<?php
$CONFIG = array (
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'apps_paths' =>
array (
0 =>
array (
'path' => '/var/www/html/apps',
'url' => '/apps',
'writable' => false,
),
1 =>
array (
'path' => '/var/www/html/custom_apps',
'url' => '/custom_apps',
'writable' => true,
),
),
'instanceid' => '...',
'passwordsalt' => '...',
'secret' => '...',
'trusted_domains' =>
array (
0 => '...',
),
'datadirectory' => '/var/www/html/data',
'dbtype' => 'mysql',
'version' => '28.0.13.1',
'overwrite.cli.url' => '...',
'dbname' => 'nextcloud',
'dbhost' => 'db',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => '...',
'installed' => true,
'maintenance' => false,
'theme' => '',
'loglevel' => 0,
'overwriteprotocol' => 'https',
'mail_from_address' => 'nextcloud',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_domain' => '...',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => '...',
'mail_smtpsecure' => 'ssl',
'mail_smtpname' => '...',
'mail_smtppassword' => '...',
'mail_smtpport' => '465',
'default_phone_region' => 'DE',
'maintenance_window_start' => 1,
'has_rebuilt_cache' => true,
);
Apps
The output of occ app:list
(if possible).
Tips for increasing the likelihood of a response
- Use the
preformatted text
formatting option in the editor for all log entries and configuration output. - If screenshots are useful, feel free to include them.
- If possible, also include key error output in text form so it can be searched for.
- Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.