estou recebendo esse erro quando eu dou o Docker-compose up
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure api-api-1 | api-api-1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. api-api-1 | at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.0.32.jar!/:8.0.32] api-api-1 | at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.0.32.jar!/:8.0.32]
meu arquivo docker-compose.yml:
version: '3.9'
services:
api:
image: my-app-image
restart: always
ports:
- "8080:8080"
depends_on:
- db
db:
image: mysql:8
restart: always
environment:
MYSQL_DATABASE: my_database
MYSQL_USER: root
MYSQL_PASSWORD: minha_senha
MYSQL_ROOT_PASSWORD: minha_senha
ports:
- "3307:3306"
volumes:
- db_data:/var/lib/mysql
volumes:
db_data: