title: How to wait until services are ready
body: <p>I have been setting up a Jenkins pipeline using docker images. Now I need to run various services like MySQL, Redis, Memcache, Beanstalkd and Elasticsearch. To wait the job until MySQL is ready, I am using the following command :</p>
  
  <pre><code>sh "while ! mysqladmin ping -u root -h mysqlhost ; do sleep 1; done"
  sh 'echo MySQL server is up and running'
  </code></pre>
  
  <p>Where <code>mysqlhost</code> is the hostname I have provided for the container. Similarly, I need to check and wait for <code>Redis, Memcached, Beanstalkd and Elasticsearch</code>. But pinging to these services are not working as it is done for <code>MySQL</code> . How can I implement this ?</p>