Advertisements
I have created a docker image for my spring boot application but i am not able to get that to run.
Kindly help me figure this out
java.sql.SQLNonTransientConnectionException: Socket fail to connect to host:address=(host=localhost)(port=3306)(type=primary). Connection refused
.
.
2023-04-25T13:04:41.969Z WARN 1 --- [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata
java.sql.SQLNonTransientConnectionException: Socket fail to connect to host:address=(host=localhost)(port=3306)(type=primary). Connection refused
>Solution :
Use --network="host"
in your docker run command, then 127.0.0.1 in your docker container will point to your docker host. You can get more info and a possible duplicate of this.