Running Acrarium by docker-compose.yaml causes HikariPool-1 – Exception during pool initialization

Tags: , , , ,



I’m trying to run Acrarium on my local Debian 10 machine – just to test it – by running the docker-compose up command with this compose file:

version: '3.7'
services:
  database:
    image: mysql
    container_name: database
    environment:
      MYSQL_ROOT_PASSWORD: 4f3g2h1j
      MYSQL_DATABASE: acrariumdb
      MYSQL_USER: acrariumuser
      MYSQL_PASSWORD: a1b2c3d4
      MYSQL_ROOT_HOST: '%'
    expose:
      - '3306'
    volumes:
      - 'acrarium_data:/var/lib/mysql'
  acrarium:
    image: 'f43nd1r/acrarium:latest'
    container_name: acrarium
    depends_on:
      - database
    ports:
      - '8080:8080'
    environment:
      SPRING_DATASOURCE_URL: jdbc:mysql://database:3306/acrariumdb?useSSL=false&allowPublicKeyRetrieval=true&useLegacyDatetimeCode=false&serverTimezone=UTC
      SPRING_DATASOURCE_USERNAME: acrariumuser
      SPRING_DATASOURCE_PASSWORD: a1b2c3d4
      SPRING_DATASOURCE_PLATFORM: org.hibernate.dialect.MySQL57Dialect
      SPRING_JPA_DATABASE-PLATFORM: org.hibernate.dialect.MySQL57Dialect
volumes:
  acrarium_data: null

The database runs successfully, but when it comes to run acrarium, I’m getting this error in terminal:

HikariPool-1 – Exception during pool initialization. com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

In docker-compose everything seems OK and googling didn’t give any new parameter or value to use in compose file. Have you any idea what I missed here? Thanks in advance.

P.S. Here is terminal’s full output when I run docker-compose up:

Starting database ... done
Starting acrarium ... done
Attaching to database, acrarium
database    | 2021-01-08 18:53:07+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
database    | 2021-01-08 18:53:07+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
database    | 2021-01-08 18:53:07+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.22-1debian10 started.
database    | 2021-01-08T18:53:07.648889Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.22) starting as process 1
database    | 2021-01-08T18:53:07.657956Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
database    | 2021-01-08T18:53:07.822776Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
database    | 2021-01-08T18:53:08.046428Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
database    | 2021-01-08T18:53:08.129888Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
database    | 2021-01-08T18:53:08.130131Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
database    | 2021-01-08T18:53:08.132768Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
database    | 2021-01-08T18:53:08.155520Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.22'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
acrarium    |                                           _
acrarium    |      /                                  (_)
acrarium    |     /        ___   _ __    __ _   _ __   _   _   _   _ __ ___
acrarium    |    / /     / __| | '__|  / _` | | '__| | | | | | | | '_ ` _ 
acrarium    |   / ____   | (__  | |    | (_| | | |    | | | |_| | | | | | | |
acrarium    |  /_/    _  ___| |_|     __,_| |_|    |_|  __,_| |_| |_| |_|
acrarium    | 
acrarium    | 2021-01-08 18:53:09.092  INFO 1 --- [           main] com.faendir.acra.BackendApplicationKt    : Starting BackendApplicationKt v1.1.0 using Java 11.0.9.1 on 62c59e609fa4 with PID 1 (/application/BOOT-INF/classes started by root in /application)
acrarium    | 2021-01-08 18:53:09.096  INFO 1 --- [           main] com.faendir.acra.BackendApplicationKt    : No active profile set, falling back to default profiles: default
acrarium    | 2021-01-08 18:53:09.307  INFO 1 --- [           main] o.s.c.a.ConfigurationClassParser         : Properties location [file:${user.home}/.config/acrarium/application.properties] not resolvable: /root/.config/acrarium/application.properties (No such file or directory)
acrarium    | 2021-01-08 18:53:09.307  INFO 1 --- [           main] o.s.c.a.ConfigurationClassParser         : Properties location [file:${user.home}/.acra/application.properties] not resolvable: /root/.acra/application.properties (No such file or directory)
acrarium    | 2021-01-08 18:53:11.026  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
acrarium    | 2021-01-08 18:53:11.092  INFO 1 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 59 ms. Found 0 JPA repository interfaces.
acrarium    | 2021-01-08 18:53:11.466  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@1c7cd434' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
acrarium    | 2021-01-08 18:53:11.474  INFO 1 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
acrarium    | 2021-01-08 18:53:11.719  INFO 1 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
acrarium    | 2021-01-08 18:53:11.730  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
acrarium    | 2021-01-08 18:53:11.730  INFO 1 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.41]
acrarium    | 2021-01-08 18:53:11.955  INFO 1 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
acrarium    | 2021-01-08 18:53:11.956  INFO 1 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2762 ms
acrarium    | 2021-01-08 18:53:12.471  INFO 1 --- [           main] c.v.f.s.VaadinServletContextInitializer  : Search for VaadinAppShell took 175 ms
acrarium    | 2021-01-08 18:53:12.622  INFO 1 --- [           main] c.g.z.f.compression.CompressingFilter    : CompressingFilter has initialized
acrarium    | 2021-01-08 18:53:12.777  INFO 1 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
acrarium    | 2021-01-08 18:53:44.050 ERROR 1 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Exception during pool initialization.
acrarium    | 
acrarium    | com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
acrarium    | 
acrarium    | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
acrarium    |   at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:313) ~[liquibase-core-3.10.3.jar:na]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1159) ~[spring-context-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) ~[spring-context-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at com.faendir.acra.BackendApplicationKt.main(BackendApplication.kt:43) ~[classes/:1.1.0]
acrarium    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
acrarium    |   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[application/:na]
acrarium    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[application/:na]
acrarium    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[application/:na]
acrarium    |   at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[application/:na]
acrarium    | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
acrarium    | 
acrarium    | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
acrarium    |   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:na]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.NativeSession.connect(NativeSession.java:144) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   ... 40 common frames omitted
acrarium    | Caused by: java.net.SocketTimeoutException: connect timed out
acrarium    |   at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
acrarium    |   at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.SocksSocketImpl.connect(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.Socket.connect(Unknown Source) ~[na:na]
acrarium    |   at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   ... 43 common frames omitted
acrarium    | 
acrarium    | 2021-01-08 18:53:44.054  WARN 1 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in file [/application/BOOT-INF/classes/com/faendir/acra/liquibase/ChangeAwareSpringLiquibase.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
acrarium    | 
acrarium    | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
acrarium    | 2021-01-08 18:53:44.064  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
acrarium    | 2021-01-08 18:53:44.068  INFO 1 --- [           main] c.g.z.f.compression.CompressingFilter    : CompressingFilter is being destroyed...
acrarium    | 2021-01-08 18:53:44.097  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 
acrarium    | 
acrarium    | Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
acrarium    | 2021-01-08 18:53:44.122 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
acrarium    | 
acrarium    | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in file [/application/BOOT-INF/classes/com/faendir/acra/liquibase/ChangeAwareSpringLiquibase.class]: Invocation of init method failed; nested exception is liquibase.exception.DatabaseException: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
acrarium    | 
acrarium    | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1788) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1159) ~[spring-context-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) ~[spring-context-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588) ~[spring-context-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[spring-boot-2.4.1.jar:2.4.1]
acrarium    |   at com.faendir.acra.BackendApplicationKt.main(BackendApplication.kt:43) ~[classes/:1.1.0]
acrarium    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
acrarium    |   at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[application/:na]
acrarium    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[application/:na]
acrarium    |   at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[application/:na]
acrarium    |   at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[application/:na]
acrarium    | Caused by: liquibase.exception.DatabaseException: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
acrarium    | 
acrarium    | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
acrarium    |   at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:318) ~[liquibase-core-3.10.3.jar:na]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784) ~[spring-beans-5.3.2.jar:5.3.2]
acrarium    |   ... 27 common frames omitted
acrarium    | Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
acrarium    | 
acrarium    | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
acrarium    |   at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.5.jar:na]
acrarium    |   at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:313) ~[liquibase-core-3.10.3.jar:na]
acrarium    |   ... 29 common frames omitted
acrarium    | Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
acrarium    | 
acrarium    | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
acrarium    |   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[na:na]
acrarium    |   at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source) ~[na:na]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.NativeSession.connect(NativeSession.java:144) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   ... 40 common frames omitted
acrarium    | Caused by: java.net.SocketTimeoutException: connect timed out
acrarium    |   at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
acrarium    |   at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.SocksSocketImpl.connect(Unknown Source) ~[na:na]
acrarium    |   at java.base/java.net.Socket.connect(Unknown Source) ~[na:na]
acrarium    |   at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63) ~[mysql-connector-java-8.0.22.jar:8.0.22]
acrarium    |   ... 43 common frames omitted
acrarium    | 
acrarium exited with code 1

Answer

OK. It was about the environment variables. Here is the latest working docker-compose.yaml:

version: "3.7"

services:
   database:
       image: mysql:5.7
       container_name: database    
       environment:
           - MYSQL_ROOT_HOST=%
           - MYSQL_ROOT_PASSWORD=root_password
           - MYSQL_DATABASE=acrarium
           - MYSQL_USER=acrarium
           - MYSQL_PASSWORD=secure_password
       expose:
           - "3306"
       volumes:
           - ./data/:/var/lib/mysql
   acrarium:
       image: f43nd1r/acrarium:latest
       container_name: acrarium
       depends_on:
           - database
       ports:
           - 8080:8080
       restart: on-failure
       environment:
           - SPRING_DATASOURCE_URL=jdbc:mysql://database:3306/acrarium?useSSL=false&allowPublicKeyRetrieval=true&useLegacyDatetimeCode=false&serverTimezone=UTC
           - SPRING_DATASOURCE_USERNAME=acrarium
           - SPRING_DATASOURCE_PASSWORD=secure_password
           - SPRING_DATASOURCE_PLATFORM=org.hibernate.dialect.MySQL57Dialect

Also, here at acrarium’s repository you can find the history of changes: Error while upping docker-compose #188



Source: stackoverflow