Sign inSign up

maateen/dockohealer

By maateen

•Updated about 6 years ago

Monitor and restart unhealthy docker containers.

Image
0

783

maateen/dockohealer repository overview

⁠dockohealer

Build Status Docker Cloud Build Status GitHub go.mod Go version Go Report Card Maintenance GitHub

This daemon monitors and restarts unhealthy docker containers instantly. This project is inspired from docker-autoheal⁠ and written on GoLang with love.

⁠Installation

⁠Build from source
$ git clone https://github.com/maateen/dockohealer.git
$ cd dockohealer/cmd/dockohealer
$ buildTime=$(date +'%Y-%m-%d_%T')
$ gitSHA=$(git rev-parse HEAD)
$ versionString=$(git tag --sort=committerdate | tail -1)
$ go build -ldflags "-X main.buildTime=$buildTime -X main.gitSHA=$gitSHA -X main.versionString=$versionString"
⁠Use binary
$ export VERSION=v0.3
$ export OS=linux
$ export ARCH=amd64
$ wget https://github.com/maateen/dockohealer/releases/download/$VERSION/dockohealer-$OS-$ARCH-$VERSION
$ mv dockohealer-$OS-$ARCH-$VERSION /usr/local/bin/dockohealer
$ chmod +x /usr/local/bin/dockohealer

⁠Usage

⁠Standalone
$ dockohealer -version

{"buildTime":"","gitSHA":"","level":"info","msg":"","time":"2020-06-20T19:38:43+06:00","version":""}

$ dockohealer

{"level":"info","msg":"Connected to Docker.","time":"2020-04-04T15:26:05+06:00"}
{"level":"info","msg":"Listening from Docker.","time":"2020-04-04T15:26:05+06:00"}
{"containerID":"5e37d4624fbaa128d1fbdd21e3a4cf0aa78eeff48e8902ef60eca95496d3155c","level":"info","msg":"Container is unhealthy.","time":"2020-04-04T15:26:15+06:00"}
{"containerID":"5e37d4624fbaa128d1fbdd21e3a4cf0aa78eeff48e8902ef60eca95496d3155c","level":"info","msg":"Restarting container.","time":"2020-04-04T15:26:15+06:00"}
{"containerID":"5e37d4624fbaa128d1fbdd21e3a4cf0aa78eeff48e8902ef60eca95496d3155c","level":"info","msg":"Successfully restarted container.","time":"2020-04-04T15:26:15+06:00"}
⁠Docker Container
$ docker run -d \
      --name dockohealer \
      --restart=always \
      -v /var/run/docker.sock:/var/run/docker.sock \
      maateen/dockohealer

⁠Process Manager

In case of running as standalone binary, you should use systemd⁠ or supervisor⁠ to keep this daemon in running state always.

⁠Road map

  • Restart already unhealthy containers
  • Add flags to the daemon
  • Launch a dockerized version

Tag summary

Content type

Image

Digest

Size

7.6 MB

Last updated

about 6 years ago

docker pull maateen/dockohealer