Docker no Linux - Erro ao rodar as migrations
Consegui instalar e deu certo até determinado momento, mas quando rodei o comando php artisan migrate, me retornou o seguinte erro:
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'laravel' and table_type = 'BASE TABLE' order by table_name)
minha versão do mysql:
mysql Ver 15.1 Distrib 10.11.4-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
docker-compose.yml:
version: "3.7"
services:
# image project
laravel_api_cache:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
working_dir: /var/www/
volumes:
- ./:/var/www
depends_on:
- redis
networks:
- laravel
# nginx
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "8989:80"
volumes:
- ./:/var/www
- ./docker/nginx/:/etc/nginx/conf.d/
networks:
- laravel
# db mysql
db:
image: mysql:5.7.22
restart: unless-stopped
environment:
MYSQL_DATABASE: ${DB_DATABASE:-laravel}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-root}
MYSQL_PASSWORD: ${DB_PASSWORD:-userpass}
MYSQL_USER: ${DB_USERNAME:-username}
volumes:
- ./.docker/mysql/dbdata:/var/lib/mysql
ports:
- "3388:3306"
networks:
- laravel
# queue
queue:
image: especializati/laravel9-app
restart: unless-stopped
command: "php artisan queue:work"
volumes:
- ./:/var/www
depends_on:
- redis
- laravel_api_cache
networks:
- laravel
# redis
redis:
image: redis:latest
networks:
- laravel
networks:
laravel:
driver: bridge
Olá, Wenderson! Tudo bem?
Todos os seus containers estão rodando? docker ps
docker compose ps
Está rodando este comando dentro do container laravel_api_cache?
docker compose exec laravel_api_cache bash
Precisa estar logado para conseguir responder a este ticket!
Clique Aqui Para Entrar!