title: Docker-compose starts springboot and mysql, springboot can't connect mysql service
body: <p>I don't know how to configure the network property in the docker-compose.yml file,After using docker-compose up, the project runs, but can't connect to the database, look at other people's configuration,Added a links tag, but there will be an error message,sequence entries are not allowed here.<br>
  springboot,msyql5.7<br>
  dockercompose.yml</p>
  
  <pre><code>version : '3'
  services:
    mysql:
      container_name: mysql-compose
      image: mysql:5.7
      environment:
        MYSQL_DATABASE: aurora1
        MYSQL_ROOT_PASSWORD: 123456789
        MYSQL_ROOT_HOST: '%'
      networks:
        - spring-demo-network
      ports:
        - "6665:3306"
      restart: always
      command: [
        '--character-set-server=utf8mb4',
        '--collation-server=utf8mb4_unicode_ci',
        '--default-time-zone=+8:00'
      ]
  
  
    app:
      container_name: backend-compose
      build:
        context: .
        dockerfile: Dockerfile
      restart: always
      volumes:
        - .:/vol/development
      ports:
        - "8088:8088" 
      networks:
        - spring-demo-network   
      depends_on:
        - mysql
  networks:
    spring-demo-network:
      driver: bridge
  </code></pre>
  
  <p>Configuration in the springboot project :</p>
  
  <pre><code>datasource:
      url: jdbc:mysql://localhost:3306/aurora?useUnicode=yes&amp;characterEncoding=UTF-8&amp;useSSL=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=UTC
      username: root
      password: 123456789
      driverClassName: com.mysql.jdbc.Driver
  
  
  
  backend-compose | 19-06-07 08:09:02.165 [main] WARN  :  c.z.hikari.util.DriverDataSource.&lt;init&gt; - Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
  backend-compose | 19-06-07 08:09:03.324 [main] ERROR :  com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException - HikariPool-1 - Exception during pool initialization.
  backend-compose | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
  backend-compose | 
  backend-compose | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
  backend-compose |   at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
  backend-compose |   at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
  backend-compose |   at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
  backend-compose |   at com.mysql.cj.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:455)
  backend-compose |   at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
  backend-compose |   at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:207)
  backend-compose |   at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136)
  backend-compose |   at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369)
  backend-compose |   at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198)
  backend-compose |   at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467)
  backend-compose |   at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541)
  backend-compose |   at com.zaxxer.hikari.pool.HikariPool.&lt;init&gt;(HikariPool.java:115)
  backend-compose |   at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
  backend-compose |   at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:302)
  backend-compose |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804)
  backend-compose |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741)
  backend-compose |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576)
  backend-compose |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498)
  backend-compose |   at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
  backend-compose |   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
  backend-compose |   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
  backend-compose |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  backend-compose |   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:307)
  backend-compose |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  backend-compose |   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
  backend-compose |   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853)
  backend-compose |   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
  backend-compose |   at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
  backend-compose |   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
  backend-compose |   at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
  backend-compose |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
  backend-compose |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
  backend-compose |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
  backend-compose |   at com.aurora.backend.Application.main(Application.java:19)
  backend-compose |   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  backend-compose |   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  backend-compose |   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  backend-compose |   at java.lang.reflect.Method.invoke(Method.java:498)
  backend-compose |   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
  backend-compose |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
  backend-compose |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
  backend-compose |   at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
  backend-compose | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
  backend-compose |
  </code></pre>