Я новичок в docker compose и хочу присоединить mysql к моему приложению весенней загрузки.
Мой составной файл выглядит
version: '3'
volumes:
mysql_data:
services:
ww-mysql:
image: mysql:5.7
volumes:
- mysql_data:/var/lib/mysql
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ww
MYSQL_USER: admin
MYSQL_PASSWORD: admin
ww-app:
build: .
image: ww-app
ports:
- 8080:8080
depends_on:
- ww-mysql
links:
- ww-mysql
Свойства приложения, которые подключаются к mysql
spring.datasource.url = jdbc:mysql://localhost:3306/ww?useSSL=false
spring.datasource.username = admin
spring.datasource.password = admin
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
# Show or not log for each sql query
spring.jpa.show-sql = true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# Naming strategy
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager)
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
Я получаю ошибку
2019-06-05 04:58:16.411 ERROR 6 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000319: Could not get database metadata
ww-app_1 |
ww-app_1 | com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
ww-app_1 |
ww-app_1 | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Ясмущенный.У меня есть MySQL сервер, работающий на моем Ubuntu 18