I have one java spring boot application which uses mysql DB . I want to start my spring application only after mysql is up and running . ( mysql takes 40-60 sec to up ) . Please suggest how to achieve it .
here is the compose file :
version: "3.8"
services:
mysql:
networks:
- my-network-1
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_USER: root
MYSQL_DATABASE: mydb
expose:
- "3306"
my-spring:
depends_on:
- mysql
build:
context: .
dockerfile: dockerfile.dockerfile
networks:
- my-network-1
expose:
- "8080"
networks:
my-network-1:
driver: overlay
Here is docker file :
FROM openjdk:8u252-jdk
ARG JAR_FILE=/somepath/jar.jar
COPY ${JAR_FILE} my.jar
ENTRYPOINT ["java","-jar","my.jar"]
currently getting connection refused error.
Thanks
Adarsha