I am creating a Spring MVC application using ORM as a Hibernate, a web server like tomcat, and a database as a MYSQL. I ran it in my local system its working fine and using docker desktop, I try to containerize my application part only as a docker container and keep my DB in local itself like localhost and I try to run my docker container is sowing some hibernate error seems like my containerized application not able to connect to my local DB
FROM tomcat:8.5.31-jre8
RUN rm -rvf /usr/local/tomcat/webapps/ROOT
ADD /target/Ecom_XML_Configuration.war /usr/local/tomcat/webapps/ROOT.war
CMD ["catalina.sh", "run"]
EXPOSE 8080
Connection string :jdbc:mysql://localhost:3306/ecom?useSSL=false&serverTimezone=UTC
Error : Unable to open JDBC Connection for DDL execution