Docktor fixes other containers, it is a sidecar container which takes actions when it's companion(s) fail(s).
Get it on Docker Hub: https://registry.hub.docker.com/u/sillelien/docktor
The Docktor checks every CHECK_INTERVAL
(default 60) seconds whether the containers it links to are still active using the command supplied.
The linked containers have the environmental variables set on them: CHECK_COMMAND
and FIX_COMMAND
. CHECK_COMMAND
will be passed to a Bash shell for evaluation, if it exits with zero (success) then nothing happens, if it exits with non-zero (fail) then FIX_COMMAND
is executed to try and fix the problem. Usually this will be just to restart a container etc.
Docktor comes with a set of scripts to make your life easier they are in /scripts/checks and /scripts/fixes - if you want to add, please issue a pull request with the scripts added to the appropriate subdirectory.
An example tutum.yml is shown below and can be deployed by the button after it.
docktor:
image: sillelien/docktor
links:
- test
roles:
- global
test:
image: nginx
environment:
CHECK_COMMAND: "curl http://${TEST_PORT_80_TCP_ADDR}:{TEST_PORT_80_TCP_PORT} | grep nginx.com"
FIX_COMMAND: "/scripts/fixes/tutum_restart.sh ${TEST_TUTUM_API_URL}"
This checks to see if the Nginx server is running on port 80, if not it runs a pre-supplied script that restarts the container on Tutum.
Additional resources to a usual Docker Alpine image include the following: curl, nmap, socat, (netcat), Bash, Docker, Python, Pip. As well as these CLIs for the following services are include: Tutum, Digital Ocean, Amazon Web Services. If you have suggestions for other CLIs please let me know.