SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known
I finally figured out what was causing this error for me. I'm using docker but I wasn't running php artisan migrate
from the shell in the container. I was just running it in Terminal after navigating to the laravel project folder.Go to your docker dashboard and launch the CLI for the laravel container in the image for your project. Then run the migrate command.