Public | Automated Build

Last pushed: 2 years ago
Short Description
Small docker wait-for-hosts-coming-up-and-listening image.
Full Description

docker-wait is a really small Docker utility that blocks until other container(s) is(are) accepting TCP connections, and errors-out if it cannot connect within a given timeout.

Possible uses are:

  • in CI environments, to ensure that containers are up before tests begin running against them
  • in a deployment pipeline, to assure the correct startup sequence (orchestrator-like)

The default operation looks up all the EXPOSE-d ports of all the linked containers and waits for them.

$ docker run -d --name nasturzo some-image-or-other
$ docker run --rm --link nasturzo netservice/docker-wait
waiting for .. up!
Everything is up and listening

It doesn't matter what the link aliases are.


  • you want to wait for only a subset of the links/ports, or
  • you want to connect to hosts/ports that haven't been linked explicitly via --link, or
  • you want to check hosts are outside the containerized environment you're running inside

then you can provide a comma-delimited list of host:port targets in the TARGETS variable:

$ docker run --rm -e TARGETS=, netservice/docker-wait
waiting for .up!
waiting for . up!
Everything is up and listening

By default each connection attempt will give up after 10 seconds. You can specify a custom timeout via the TIMEOUT env variable:

$ docker run --rm -e -e TIMEOUT=25 netservice/docker-wait
waiting for ......................... ERROR: unable to connect

If any TARGET times out, the docker-wait container immediately exits with status code 1.

Usage consideration

It's a good practice IMHO to run this kind of container and delete it immediately afterwards, using --rm or remove:true. Running a docker-gc or a cleanup script regularly it's another thing.

Credits /

Docker Pull Command
Source Repository