I use laradock for a few days. I had it working but since today run into a problem when running "php artisan migrate" error code:
"Illuminate\Database\QueryException SQLSTATE[HY000] [2002]
php_network_getaddresses: getaddrinfo failed:
Name or service not known
(SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')"
My containers are all up and running and I can access my workspace and my mysql container and see the (previously created) tables in my mysql container. My .env file shows:
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=root
DB_PASSWORD=root
most notably my DB_HOST name is mysql which seems to be the problem in most threads I found about the topic.
My docker containers show:
$ docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------
f3acb119d329_laradock docker-entrypoint.sh Up 0.0.0.0:3307->3306/t
_mysql_1 mysqld cp, 33060/tcp
laradock_docker-in- dockerd-entrypoint.sh Up 2375/tcp, 2376/tcp
docker_1
laradock_nginx_1 /bin/bash Up 0.0.0.0:443->443/tcp
/opt/startup.sh , 0.0.0.0:8881->80/t
cp,
0.0.0.0:81->81/tcp
laradock_php-fpm_1 docker-php-entrypoint Up 9000/tcp
php-fpm
laradock_phpmyadmin_1 /docker-entrypoint.sh Exit 128
apac ...
laradock_redis_1 docker-entrypoint.sh Up 0.0.0.0:6379->6379/t
redis ... cp
laradock_workspace_1 /sbin/my_init Up 0.0.0.0:2222->22/tcp
, 0.0.0.0:3000->3000
/tcp, 0.0.0.0:3001->
3001/tcp, 0.0.0.0:80
01->8000/tcp, 0.0.0.
0:8080->8080/tcp
It would be great if someone could help me with this, because I unsuccessfully tried to fix it all day. If more information is required please tell me what's missing to solve this.