• Stars
    star
    1,279
  • Rank 36,459 (Top 0.8 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 7 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Monitor and restart unhealthy docker containers.

Docker Autoheal

Monitor and restart unhealthy docker containers. This functionality was proposed to be included with the addition of HEALTHCHECK, however didn't make the cut. This container is a stand-in till there is native support for --exit-on-unhealthy moby/moby#22719.

Supported tags and Dockerfile links

How to use

UNIX socket passthrough

docker run -d \
    --name autoheal \
    --restart=always \
    -e AUTOHEAL_CONTAINER_LABEL=all \
    -v /var/run/docker.sock:/var/run/docker.sock \
    willfarrell/autoheal

TCP socket

docker run -d \
    --name autoheal \
    --restart=always \
    -e AUTOHEAL_CONTAINER_LABEL=all \
    -e DOCKER_SOCK=tcp://HOST:PORT \
    -v /path/to/certs/:/certs/:ro \
    willfarrell/autoheal

a) Apply the label autoheal=true to your container to have it watched.

b) Set ENV AUTOHEAL_CONTAINER_LABEL=all to watch all running containers.

c) Set ENV AUTOHEAL_CONTAINER_LABEL to existing label name that has the value true.

Note: You must apply HEALTHCHECK to your docker images first. See https://docs.docker.com/engine/reference/builder/#healthcheck for details. See https://docs.docker.com/engine/security/https/ for how to configure TCP with mTLS

The certificates, and keys need these names:

  • ca.pem
  • client-cert.pem
  • client-key.pem

Change Timezone

If you need the timezone to match the local machine, you can map the /etc/localtime into the container.

docker run ... -v /etc/localtime:/etc/localtime:ro

ENV Defaults

AUTOHEAL_CONTAINER_LABEL=autoheal
AUTOHEAL_INTERVAL=5   # check every 5 seconds
AUTOHEAL_START_PERIOD=0   # wait 0 seconds before first health check
AUTOHEAL_DEFAULT_STOP_TIMEOUT=10   # Docker waits max 10 seconds (the Docker default) for a container to stop before killing during restarts (container overridable via label, see below)
DOCKER_SOCK=/var/run/docker.sock   # Unix socket for curl requests to Docker API
CURL_TIMEOUT=30     # --max-time seconds for curl requests to Docker API
WEBHOOK_URL=""    # post message to the webhook if a container was restarted (or restart failed)

Optional Container Labels

autoheal.stop.timeout=20        # Per containers override for stop timeout seconds during restart

Testing

docker build -t autoheal .

docker run -d \
    -e AUTOHEAL_CONTAINER_LABEL=all \
    -v /var/run/docker.sock:/var/run/docker.sock \
    autoheal                                                                        

More Repositories

1

alfred-workflows

Alfred Workflows for Developers
JavaScript
1,956
star
2

alfred-pkgman-workflow

Package Repo Search
PHP
699
star
3

alfred-encode-decode-workflow

Encoding and decoding a string into multiple variations.
PHP
529
star
4

alfred-caniuse-workflow

Alfred App Workflow for caniuse.com
PHP
408
star
5

docker-crontab

A docker job scheduler (aka. crontab for docker)
Shell
278
star
6

alfred-dash-workflow

[Depreciated] Documentation Lookup
214
star
7

alfred-github-workflow

Searching Github repos.
PHP
209
star
8

Browsers

Collection of Browsers and Virtual Machines for web development on the Mac.
Python
94
star
9

alfred-hash-workflow

Hashing Strings
PHP
87
star
10

alfred-youtube-workflow

Search and Download YouTube Videos
Python
76
star
11

php

collection of php classes, libraries, and include files I use
PHP
73
star
12

alfred-cdn-workflow

Check which CDNs a package is hosted on.
PHP
65
star
13

angular-io-app

A web app wrapper for those who love AngularJS and Twitter Bootstrap.
JavaScript
37
star
14

ievms

IE VMs for VMWare Fusion
Shell
33
star
15

apidoc-plugin-schema

@apiSchema Plugin for apidoc
JavaScript
32
star
16

ansible-playbook-aws

ansible playbook to setup minimal VPC, EC2, ELB, RDS
Python
23
star
17

alfred-debugger

A little script to help you write your Alfred Workflows.
Shell
23
star
18

alfred-localhost-workflow

[Depreciated] Toggle Localhost Services
PHP
22
star
19

angular-modernizr

Collection of AngularJS fallbacks for less modern browsers.
JavaScript
22
star
20

alfred-blank-workflow

A template Alfred Workflow repo to get your next workflow started.
PHP
20
star
21

Leaflet.Clipper

Allows Union, Difference, Xor, and Intersection operations on two polygons.
JavaScript
15
star
22

docker-filebeat

Docker image for Elastic Filebeat
Shell
11
star
23

terraform-aws-template

Project temple for building out a full AWS application
HCL
10
star
24

dotCrontab

Easy access to Mac OS X crontab. Great for automatically updating brew or npm.
Shell
8
star
25

docker-letsencrypt

container to generate letsencrypt certs using dehydrated + lexicon
Dockerfile
8
star
26

dotVhosts

Lightweight VirtualHost manager for Mac.
PHP
8
star
27

csv-rex

🦖 A tiny and fast CSV parser & formatter for JavaScript.
JavaScript
7
star
28

aws-wishlist

List of features I'd love to see come to AWS
6
star
29

docker-ping

Container to continuously ping a server
Shell
6
star
30

node-semver-compare-range

Comparator for semver sorting.
JavaScript
5
star
31

docker-nginx

prebuild configs for nginx including letsencrypt bootstrapping
Shell
5
star
32

middy-jsonapi

JSONAPI middleware for middy
JavaScript
5
star
33

ansible-playbook-bastion

CentOS Bastion Host Setup
Shell
5
star
34

terraform-account-modules

Collection of global sub account modules
HCL
5
star
35

fluent-transpiler

Transpile Fluent (ftl) files into optomized, tree-shakable, JavaScript EcmaScript Modules (esm).
JavaScript
5
star
36

Coda-Plugins

A few Coda 2 Plugins
PHP
4
star
37

datastream

Commonly used stream patterns for Web Streams API and NodeJS Streams
JavaScript
4
star
38

secret-patterns

RegExp patterns for code secrets
Shell
4
star
39

angular-io

AngularIO - Collection of AngularJS modules worth checking out.
JavaScript
4
star
40

apidoc-plugin-example

@apiExample
JavaScript
4
star
41

documentation

Documentation for policies, process, and templates
4
star
42

Mac-OSX-Bash-Files

batch file to create a list of tv show (w/ ststs) from a nested folder structure
PHP
3
star
43

contribPlusPlus

Keeping Github green ... yeah, we like green.
3
star
44

middy-rds

Middy middleware for creating a db connection using knex
JavaScript
3
star
45

docker-kafka

kafka for docker v1.11+
Shell
2
star
46

ajv-ftl-i18n

Internationalized error messages for Ajv - superfast JSON validator for JSON Schema and JSON Type Definition.
Fluent
2
star
47

serverless-terraform

Convert serverless config into a terraform module
JavaScript
2
star
48

Coda-Dreamweaver-Color-Theme

The code color template smiliar to Dreamweaver for Coda
2
star
49

ajv-cmd

Transpile JSON-Schema (.json) files to JavaScript (.js or .mjs) using ajv
JavaScript
2
star
50

js

collection of js files I use often
JavaScript
2
star
51

accessibility

Collection of web design patterns
2
star
52

font-awesome-auto-sub-set

A PHP script to get a sub-set of Font-Awesome icons that are used in your app.
PHP
2
star
53

docker-vault-env

script to bootstrap ENV from vault
Shell
2
star
54

terraform-waf-module

OWASP WAF
HCL
2
star
55

terraform-public-static-assets-module

Terraform Module: CloudFront, ACM, S3
HCL
2
star
56

serverless-template

Boilerplate for serverless
JavaScript
2
star
57

keyStorage.js

Simple wrapper for JavaScript localStorage
JavaScript
2
star
58

lib.parse

parsing libraries for js and php
PHP
1
star
59

csv-benchmarks

Benchmarks of popular CSV libraries
JavaScript
1
star
60

workbee

A tiny ServiceWorker for secure web applications.
JavaScript
1
star
61

a11ychart

Accessibility focused charting library [WIP]
1
star
62

mac-ci

Scripts to autoset a Jenkins CI on a Mac. Great to put on a spare Mac mini.
Shell
1
star
63

docker-selfsigncert

Docker for creating self signed tls certificates
Shell
1
star
64

apidoc-plugins

Collection of plugins for apidoc and a place to request new ones.
1
star
65

docker-redis

base redis with optimized configs + healthcheck
Shell
1
star
66

terraform-vpc-module

VPC w/ NATs
HCL
1
star
67

terraform-state-module

Terraform module: Set up state backend using S3 & DynamoDB
HCL
1
star
68

prettier-standard

Just a simple wrapper around Prettier & Standard with auto-fix enabled.
Shell
1
star
69

docker-elasticsearch-curator

delete old logs
Shell
1
star
70

ansible-role-sshd

Setup user accounts on CentOS
1
star