Download the blueprint that can take a company of any maturity level all the way up to enterprise-scale continuous delivery using a combination of Automic Release Automation, Automic’s 20+ years of business automation experience, and the proven tools and practices the company is already leveraging.

We make extensive use of Docker and Docker Compose at Tasktop for building, testing and deploying our products. One of the pain points that we run in to is services that fail to start when other services are not available – for example a web app that fails to start unless the database is already up and running. Apparently we’re not the only ones, so here’s a bit of bash hackery to work around the problem:

until nc -z -v -w5 $SERVICE_HOST $SERVICE_PORT;
do
echo "waiting for service to become available on $SERVICE_HOST:$SERVICE_PORT"
sleep 1
done

This hack uses netcat (nc) to wait for a socket accepting connections on the specified host and port. The -z flag causes netcat to detect the listening socket without actually sending any data.

To make this work in a Docker container, you’ll have to ensure that netcat is available: