Skip to content

idlerun/ready-wait

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

page title tags date
Ready-Wait For Docker Containers
docker
2015-11-24

Docker supports linking together containers and will ensure that containers only start if the containers they depend on are started. It doesn't have anything (yet) for app-specific logic which indicates whether the dependency is actually ready.

Here is a simple Python script which can be run inside of a container to delay starting the app code until preconditions are met.

Script

The following is the script which will run and wait until the preconditions defined in the yaml definition below are met

Configuration

The script above expects a configuration file at /etc/ready_wait.yaml like the following

hostname1:
  http:
    port: 80
    uri: /status
    status: 200
    contains: OK

hostname2:
  tcp:
    port: 80

Docker Usage

Modify the Docker container CMD to wait for ready_wait to complete before running the normal app entrypoint for your container. For example:

FROM ubuntu
ADD ready_wait.py /usr/bin/ready_wait
ADD ready_wait.yaml /etc/ready_wait.yaml
...
CMD ready_wait && /entrypoint.sh

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages