Forked from mvargeson/docker-compose-wait-for-db.sh
Last active
November 1, 2022 19:03
-
-
Save shams-ali/b5777887d28a6638c4cf72027eec1c72 to your computer and use it in GitHub Desktop.
wait for db container to be available before starting server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash THIS WORKED | |
bash -c 'while ! </dev/tcp/db/5432; do sleep 1; done; nodal db:bootstrap && nodal s;' | |
#THIS WORKS ONLY IF NETSTST INSTALLED | |
while ! nc -w 1 -z db 5432; do sleep 0.1; done | |
#ANOTHER WAY | |
until nc -z postgres 5432; do | |
echo "$(date) - waiting for postgres..." | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe you meant netcat.