GithubHelp home page GithubHelp logo

docker-wait's Introduction

docker-wait

dokku/wait

wait is a really small (9MB) Docker utility that blocks until another container is accepting TCP connections, and errors-out if it cannot connect within a given timeout. It can be used to ensure that a service is up and running before starting another service that depends on it.

The default operation looks up all the EXPOSEd ports of all the linked containers and waits for them

$ docker run -d --name mycontainer some-image-or-other
$ docker run --link mycontainer:mycontainer --rm dokku/wait
Waiting for 172.17.0.105:5432  .  up!
Everything is up

It doesn't matter what the link alias is.

If you want to wait for only a subset of the ports in a linked container, you can provide the list with the -p parameter:

$ docker run -d --name mycontainer some-image-or-other
$ docker run --link mycontainer:mycontainer --rm dokku/wait -p 5432
Not checking 172.17.0.105:6379 because port is not included.
Waiting for 172.17.0.105:5432  .  up!
Everything is up

If you want to connect to hosts/ports that haven't been linked by Docker, you can provide the list with the -c parameter:

$ docker run --rm dokku/wait -c 8.8.8.8:53,github.com:443
Waiting for 8.8.8.8:53  .  up!
Waiting for github.com:443  .  up!
Everything is up

By default each connection attempt will bail after 30 seconds. You can override this with -t parameter:

$ docker run dokku/wait -c github.com:5432 -t 15
Waiting for github.com:5432  ...............................  ERROR: unable to connect

If any connection times out, the wait container immediately exits with status code 1

credits

waisbrot/wait: https://github.com/waisbrot/docker-wait n3llyb0y/wait: https://github.com/n3llyb0y/docker-wait aanand/wait: https://github.com/aanand/docker-wait

docker-wait's People

Contributors

aanand avatar chadoe avatar dependabot-preview[bot] avatar flink avatar josegonzalez avatar waisbrot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.