Docker doctor - health checker container for achieving zero downtime when using one container for app
The docker container checker waits until the new container is fully prepared and then removes the old one. Basically it checks the docker event sent from staring container. If have set HEALTH_CHECKER environment property then waits until their health is ok and afterwards old container is stopped and removed.
You have some application defined in docker (see examples/nodejsapp). When your CI runs the deployment phase it starts the new container and removes old one. But it takes some time to boot up application to healthy state. And if you have only one container it causes downtime. So you can setup the checker which waits until the new container is fully prepared and then removes the old one.
docker-compose up
or see the example of usage with nginx, nginx-proxy, letsencrypt as a server docker-gateway
docker-compose -f docker-compose.yml --project-name=$(date +%s) up --scale nodejs_app=1 -d
| env | values | default | meaning |
|---|---|---|---|
| VIRTUAL_PORT | number | - | application listening port (same name as for nginx-proxy) |
| HEALTH_CHECKER | http, https | - | active script used to check health |
| HEALTH_MAX_RETRY | number | 30 | (optional) maximum number of attempts to check health |
| HEALTH_TIMEOUT | number | 1000 | (optional) number of ms to check in one attempt |
- Good VPS or dedicated server
- Installed docker and docker-compose
- nginx-proxy as a gateway for your deployed containers - they are automatically proxied - so your service is balanced between two containers.