A tool to wait for services and execute command. Useful in Docker containers.

License: BSD-2-Clause

Language: Python

Keywords: docker, dockerize, healthcheck, holdup, http, python, tcp, wait-for-it


docs Documentation Status
Travis-CI Build Status Requirements Status
Coverage Status

A tool to wait for services and execute command. Useful for Docker containers that depend on slow to start services (like almost everything).

  • Free software: BSD 2-Clause License


pip install holdup


Usage: holdup [-h] [-t SECONDS] [-T SECONDS] [-i SECONDS] [-n] [--insecure] service [service ...] [-- command [arg [arg ...]]]

Wait for services to be ready and optionally exec command.

Positional arguments:
A service to wait for. Supported protocols: "tcp://host:port/", "path:///path/to/something", "unix:///path/to/domain.sock", "eval://expr", "http://urn", "http://urn", "https+insecure//urn" (status 200 expected). Join protocols with a comma to make holdup exit at the first passing one, eg: tcp://host:1,host:2 or tcp://host:1,tcp://host:2 are equivalent and mean "any that pass".
An optional command to exec.
Optional arguments:
-h, --help show this help message and exit
-t SECONDS, --timeout SECONDS
  Time to wait for services to be ready. Default: 60.0
-T SECONDS, --check-timeout SECONDS
  Time to wait for a single check. Default: 1.0
-i SECONDS, --interval SECONDS
  How often to check. Default: 0.2
-n, --no-abort Ignore failed services. This makes holdup return 0 exit code regardless of services actually responding.
--insecure Skip SSL Certificate verification for HTTPS services.

Suggested use

Assuming you always want the container to wait add this in your Dockerfile:

CMD ["/bin/bash"]

Then in you could have:

set -eux
urlstrip() { string=${@##*://}; echo ${string%%[\?/]*}; }
exec holdup \
     "tcp://$(urlstrip $CELERY_RESULT_BACKEND)" \
     -- "$@"

The only disadvantage is that you might occasionally need to use docker run --entrypoint='' to avoid running holdup. No biggie.

Insecure HTTPS Service Checks

You may choose to skip SSL validation when waiting for an HTTPS service (for e.g., when using an IP Address). This can be done using either of the following methods:

# Specifying a https+insecure protocol
holdup https+insecure://

# Specifying the --insecure` option
holdup --insecure

Skipping SSL Certificate verification requires a minimum of Python-2.7.9 or Python-3.4.3.


To run the all tests run:


Note, to combine the coverage data from all the tox environments run:

set PYTEST_ADDOPTS=--cov-append
PYTEST_ADDOPTS=--cov-append tox

Project Statistics

Sourcerank 5
Repository Size 104 KB
Stars 21
Forks 1
Watchers 2
Open issues 2
Dependencies 4
Contributors 3
Tags 13
Last updated
Last pushed

Top Contributors See all

Ionel Cristian Mărieș Mithun Ayachit Blaise Kal

Packages Referencing this Repo

A tool to wait for services and execute command. Useful for Docker containers that depend on slow...
Latest release 1.8.0 - Updated - 21 stars

Recent Tags See all

v1.8.0 May 28, 2019
v1.7.0 November 23, 2018
v1.6.0 March 22, 2018
v1.5.0 June 09, 2017
v1.4.0 March 27, 2017
v1.3.0 February 21, 2017
v1.2.1 June 17, 2016
v1.2.0 May 25, 2016
v1.1.0 May 06, 2016
v1.0.0 April 21, 2016
v0.1.3 April 21, 2016
v0.1.2 April 21, 2016
v0.1.1 April 21, 2016

Something wrong with this page? Make a suggestion

Last synced: 2019-10-12 01:17:14 UTC

Login to resync this repository