Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:10
What would you like to do?
Start-up script to eliminate potential race condition between the MongoDB data Docker container and the Node.js web-application container in a 'Dockerized' MEAN application. (post:
# Start-up script from inside web_1 (web-application) container
# Gary A. Stafford
# great references:
# Docker Networking Made Simple or 3 Ways to Connect LXC Containers
# (
# Docker 101: Dockerizing Your Infrastructure (
echo "wait for mongo to start first..."
# optional, view db_1 container-related env vars
env | grep DB_1 | sort
# wait until mongo is running in db_1 container
until nc -z $DB_1_PORT_27017_TCP_ADDR $DB_1_PORT_27017_TCP_PORT
echo "waiting for $polling_interval seconds..."
sleep $polling_interval
# start node app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment