Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name does not resolve (SQL: select * from
tablename
)
The test working in container but broken in IDE. Do you have any ideas what is the problem in PhpStorm?
I ran into this exact issue. Assuming you already have the Docker container and PHP interpreter set up, this is how I got it to connect to the MySQL container:
docker network ls
from the CLI and saw the "lighthouse_default" networkObviously, in your situation the network name will likely be different. The real point is that I had to make sure I was using the right network and make sure the database image is in the Container Links.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With