I'm creating a mariaDB container via docker run
with -v pathToSQL:/docker-entrypoint-initdb.d/script.sql
option via Java. I have no idea how to find out when the container is ready to be connected with my JDBC client. How can I find out when the initial script stopped executing and the DB is ready to work? I'd like to avoid something like Thread.sleep(20000)
, which is my current solution. I'd like to achieve something like this:
Execute command
IF
return OK then connect do DB
ELSE
wait 5 second and execute command again.