Giter Site home page Giter Site logo

touilleio / docker-autoheal Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 32 KB

Restart docker containers when marked as unhealthy, (re)written in GO.

Dockerfile 6.92% Makefile 13.12% Go 79.97%
docker docker-compose healthcheck autoheal health-check

docker-autoheal's Introduction

Docker autoheal

This tool monitors and restarts unhealthy docker containers. This functionality was proposed to be included with the addition of HEALTHCHECK, however didn't go through. This tool is a workaround till there is native support for --restart-on-unhealthy or similar (moby/moby#22719).

Disclaimer

This docker-autoheal is a rewrite of the excellent docker-autoheal from Will Farrell, but in golang. It is fully compliant with willfarrell/docker-autoheal, plus few goodies such as metrics (see below)

Compatibility

  • AUTOHEAL_INTERVAL, AUTOHEAL_START_PERIOD, AUTOHEAL_DEFAULT_STOP_TIMEOUT and CURL_TIMEOUT are duration and are treated as seconds if no unit provided. For more precision 5 can be written 5s.
  • DOCKER_SOCK env variable can be written to more standard DOCKER_HOST. DOCKER_SOCK can still be used.

Configuration

Environment variable to configure docker-autoheal

Env var name Default Description
AUTOHEAL_CONTAINER_LABEL autoheal Specify the name of the label optin'ing to autoheal process. A special value all means all containers are watched
AUTOHEAL_INTERVAL 5s Interval at which containers health is checked
AUTOHEAL_START_PERIOD 0s Warmup time before running the first check
AUTOHEAL_DEFAULT_STOP_TIMEOUT 10s Time to give to containers before shutting down
DOCKER_HOST (or DOCKER_SOCK) /var/run/docker.sock Path/URI of docker socket
CURL_TIMEOUT 30s Timeout when interacting with docker

Additional configuration for the containers

Label name Description
autoheal if true or AUTOHEAL_CONTAINER_LABEL=all, means this container is watched
autoheal.stop.timeout Per containers override for stop timeout seconds during restart, as a duration, e.g. 120s

Metrics

Metrics name Type Description
check_count counter Count how many times containers have been checked
check_failure_count counter Count how many failures happened trying to check containers
restart_count counter Count how many containers have been restated
restart_failure_count counter Count how many restart failures happened

docker-autoheal's People

Contributors

killerwhile avatar

Stargazers

 avatar

Watchers

 avatar  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.