Communications link failure , Spring Boot + MySql +Docker + Hibernate
Issue is due to reference of localhost in the jdbc url.
Below configuration should work.
**docker-compose.yml**version: '3'services: docker-mysql: image: mysql:5.7 environment: - MYSQL_ROOT_PASSWORD=root - MYSQL_DATABASE=database - MYSQL_USER=root - MYSQL_PASSWORD=root ports: - 3307:3306 app: image: app:latest ports: - 8091:8091 environment: SPRING_DATASOURCE_URL: jdbc:mysql://docker-mysql:3306/database?autoReconnect=true&useSSL=false depends_on: - docker-mysql
This Docker forum discussion helped me when I was running into this error. For me it was a problem with cache and I didn't get the error after running docker-compose down --rmi all
did you tell your docker that it depends on SQL?I mean is there something like this:
depends_on: - mysql_server
in your docker-compose.yml ?
looks like a configuration issue.