Skip to content

Docker DDEV / DB error | php_network_getaddresses: getaddrinfo for mysql failed: Temporary failure in name resolution

I’m quite new to the Docker and DDEV material.
I’ve setup a local instance of our Magento repository, using Docker and DDEV.
Imported the database and changed the env.php using the following settings for the DB:
env db settings

But I keep getting the following error when I try to run bin/magento setup:upgrade

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for mysql
failed: Temporary failure in name resolution

I also tried to run the command from inside the container, by first getting into the container using docker exec -ti ddev-containername-web bash, but the same result unfortunately.

It seems that there is something wrong with the connection between the Magento install and the db, but I can’t find what it is.

My environment:

  • Windows 11
  • WSL2 (Ubuntu)
  • Docker Desktop