Quando executo minha aplicação pela IDE, roda certinho, autentica, gera token, grava no banco de dados mysql, tudo como esperado, mas quando tento rodar o docker dá erro. Estou rodando tudo no Ubuntu
Meu Dockerfile
FROM rsunix/yourkit-openjdk17
EXPOSE 8080
ADD /target/forum-1.0.0.jar forum.jar
ENTRYPOINT ["java", "-jar", "forum.jar"]
$ docker run -p 3080:8080 forum
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.13)
2024-09-11 01:20:09.025 INFO 1 --- [ main] br.com.alura.forum.ForumApplicationKt : Starting ForumApplicationKt v1.0.0 using Java 17.0.2 on e833227de446 with PID 1 (/forum.jar started by root in /)
2024-09-11 01:20:09.027 INFO 1 --- [ main] br.com.alura.forum.ForumApplicationKt : No active profile set, falling back to default profiles: default
2024-09-11 01:20:09.761 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2024-09-11 01:20:09.816 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 47 ms. Found 4 JPA repository interfaces.
2024-09-11 01:20:10.228 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2024-09-11 01:20:10.235 INFO 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2024-09-11 01:20:10.236 INFO 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.55]
2024-09-11 01:20:10.267 INFO 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2024-09-11 01:20:10.267 INFO 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1188 ms
2024-09-11 01:20:10.403 INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2024-09-11 01:20:10.445 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2024-09-11 01:20:10.544 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2024-09-11 01:20:10.620 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2024-09-11 01:20:11.689 ERROR 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : 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.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.27.jar!/:8.0.27]
$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 71
Server version: 8.0.39-0ubuntu0.24.04.2 (Ubuntu)
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>