I have a java war file that creates tables in MySQL database, so I tried to deploy the war file in tomcat container. This works in Windows and tables are being created but when I am trying to use it in Virtual Box Ubuntu VM the tables are not being created.
Please find the docker-compose code.
version: "3.3"
services:
db:
image: mysql:8.0.19
volumes:
- /opt/test:/var/lib/mysql
- ./mysql-dump:/docker-entrypoint-initdb.d
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: mydb
MYSQL_USER: root
MYSQL_PASSWORD: root
ports:
- 3306:3306
phpmyadmin:
depends_on:
- db
image: phpmyadmin/phpmyadmin
ports:
- "8083:80"
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: root
web:
image: tomcat:9.0.33
volumes:
- ./target/server.xml:/usr/local/tomcat/conf/server.xml
- ./target/ROOT.war:/usr/local/tomcat/web_app/ROOT.war
- ./target/ROOTms.war:/usr/local/tomcat/monitoringservice/ROOT.war
ports:
- "8081:8081"
- "8080:8080"
links:
- db
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/mydb?maxAllowedPacket=16581375&sslMode=DISABLED&useSSL=false&allowPublicKeyRetrieval=true