From 13d6bf471da363a2901009aa60781c0a5339e13e Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Sun, 9 Jul 2017 15:54:51 +0200 Subject: [PATCH] Wait for database to be started before running MySQL client command --- docker/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/init.sh b/docker/init.sh index aedb0874..16a55231 100644 --- a/docker/init.sh +++ b/docker/init.sh @@ -31,7 +31,7 @@ user=$MYSQL_USER password=$MYSQL_PASSWORD ABC -if [ $(echo "show tables;" | mysql --host $DATABASE_HOST --port $DATABASE_PORT $MYSQL_DATABASE | wc -l) -le 1 ]; then +if [ $(echo "show tables;" | dockerize -wait tcp://$DATABASE_HOST:$DATABASE_PORT -timeout 60s mysql --host $DATABASE_HOST --port $DATABASE_PORT $MYSQL_DATABASE | wc -l) -le 1 ]; then echo ">>> Initializing database..." dockerize -wait tcp://$DATABASE_HOST:$DATABASE_PORT -timeout 60s bundle exec rake db:schema:load fi