title: How can I wait for a docker container to be up and running?
body: <p>When running a service inside a container, let's say mongodb, the command </p>
  
  <pre><code>docker run -d myimage
  </code></pre>
  
  <p>will exit instantly, and return the container id.
  In my CI script, I run a client to test mongodb connection, right after running the mongo container.
  The problem is: the client can't connect because the service is not up yet.
  Apart from adding a big <code>sleep 10</code>in my script, I don't see any option to wait for a container to be up and running.</p>
  
  <p>Docker has a command <code>wait</code> which doesn't work in that case, because the container doesn't exist.
  Is it a limitation of docker?</p>