{"id":13446422,"url":"https://github.com/willfarrell/docker-autoheal","last_synced_at":"2025-05-15T14:05:52.606Z","repository":{"id":38417510,"uuid":"81697260","full_name":"willfarrell/docker-autoheal","owner":"willfarrell","description":"Monitor and restart unhealthy docker containers.","archived":false,"fork":false,"pushed_at":"2024-03-30T19:56:20.000Z","size":99,"stargazers_count":1486,"open_issues_count":60,"forks_count":238,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-04-07T17:05:29.169Z","etag":null,"topics":["docker"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willfarrell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["willfarrell"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2017-02-12T02:17:19.000Z","updated_at":"2025-04-06T09:57:10.000Z","dependencies_parsed_at":"2022-07-11T19:49:52.635Z","dependency_job_id":"49638f09-1095-40f5-a16e-0b834d171cff","html_url":"https://github.com/willfarrell/docker-autoheal","commit_stats":{"total_commits":95,"total_committers":38,"mean_commits":2.5,"dds":0.8,"last_synced_commit":"31a64b4ba73d0215032b0466960ff358560ef558"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fdocker-autoheal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fdocker-autoheal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fdocker-autoheal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willfarrell%2Fdocker-autoheal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willfarrell","download_url":"https://codeload.github.com/willfarrell/docker-autoheal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254355334,"owners_count":22057354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker"],"created_at":"2024-07-31T05:00:52.999Z","updated_at":"2025-05-15T14:05:47.598Z","avatar_url":"https://github.com/willfarrell.png","language":"Shell","readme":"# Docker Autoheal\n\nMonitor and restart unhealthy docker containers. \nThis functionality was proposed to be included with the addition of `HEALTHCHECK`, however didn't make the cut.\nThis container is a stand-in till there is native support for `--exit-on-unhealthy` https://github.com/docker/docker/pull/22719.\n\n## Supported tags and Dockerfile links\n- [`latest` (*Dockerfile*)](https://github.com/willfarrell/docker-autoheal/blob/main/Dockerfile) - Built daily\n- [`1.1.0` (*Dockerfile*)](https://github.com/willfarrell/docker-autoheal/blob/1.1.0/Dockerfile)\n- [`v0.7.0` (*Dockerfile*)](https://github.com/willfarrell/docker-autoheal/blob/v0.7.0/Dockerfile)\n\n\n![](https://img.shields.io/docker/pulls/willfarrell/autoheal \"Total docker pulls\") [![](https://images.microbadger.com/badges/image/willfarrell/autoheal.svg)](http://microbadger.com/images/willfarrell/autoheal \"Docker layer breakdown\")\n\n## How to use\n\n### 1. Docker CLI\n#### UNIX socket passthrough\n```bash\ndocker run -d \\\n    --name autoheal \\\n    --restart=always \\\n    -e AUTOHEAL_CONTAINER_LABEL=all \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    willfarrell/autoheal\n```\n#### TCP socket \n```bash\ndocker run -d \\\n    --name autoheal \\\n    --restart=always \\\n    -e AUTOHEAL_CONTAINER_LABEL=all \\\n    -e DOCKER_SOCK=tcp://$HOST:$PORT \\\n    -v /path/to/certs/:/certs/:ro \\\n    willfarrell/autoheal\n```\n#### TCP with mTLS (HTTPS)\n```bash\ndocker run -d \\\n    --name autoheal \\\n    --restart=always \\\n    --tlscacert=/certs/ca.pem \\\n    --tlscert=/certs/client-cert.pem \\\n    --tlskey=/certs/client-key.pem \\\n    -e AUTOHEAL_CONTAINER_LABEL=all \\\n    -e DOCKER_HOST=tcp://$HOST:2376 \\\n    -e DOCKER_SOCK=tcps://$HOST:2376 \\\n    -e DOCKER_TLS_VERIFY=1 \\\n    -v /path/to/certs/:/certs/:ro \\\n    willfarrell/autoheal\n```\nThe certificates and keys need these names and resides under /certs inside the container:\n* ca.pem\n* client-cert.pem\n* client-key.pem\n\n\u003e See https://docs.docker.com/engine/security/https/ for how to configure TCP with mTLS\n\n### Change Timezone\nIf you need the timezone to match the local machine, you can map the `/etc/localtime` into the container.\n```bash\ndocker run ... -v /etc/localtime:/etc/localtime:ro\n```\n\n### 2. Use in your container image\nChoose one of the three alternatives:\n\na) Apply the label `autoheal=true` to your container to have it watched;\u003cbr/\u003e\nb) Set ENV `AUTOHEAL_CONTAINER_LABEL=all` to watch all running containers;\u003cbr/\u003e\nc) Set ENV `AUTOHEAL_CONTAINER_LABEL` to existing container label that has the value `true`;\u003cbr/\u003e\n\n\u003e Note: You must apply `HEALTHCHECK` to your docker images first.\u003cbr/\u003e\n\u003e See https://docs.docker.com/engine/reference/builder/#healthcheck for details.\n\n#### Docker Compose (example)\n```yaml\nservices:\n  app:\n    extends:\n      file: ${PWD}/services.yml\n      service: app\n    labels:\n      autoheal-app: true\n\n  autoheal:\n    deploy:\n      replicas: 1\n    environment:\n      AUTOHEAL_CONTAINER_LABEL: autoheal-app\n    image: willfarrell/autoheal:latest\n    network_mode: none\n    restart: always\n    volumes:\n      - /etc/localtime:/etc/localtime:ro\n      - /var/run/docker.sock:/var/run/docker.sock\n```\n\n#### Optional Container Labels\n|`autoheal.stop.timeout=20`            |Per containers override for stop timeout seconds during restart|\n| --- | --- |\n\n## Environment Defaults\n|Variable                              |Description|\n| --- | --- |\n|`AUTOHEAL_CONTAINER_LABEL=autoheal`   |set to existing label name that has the value `true`|\n|`AUTOHEAL_INTERVAL=5`                 |check every 5 seconds|\n|`AUTOHEAL_START_PERIOD=0`             |wait 0 seconds before first health check|\n|`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)|\n|`AUTOHEAL_ONLY_MONITOR_RUNNING=false` |All containers monitored by default. Set this to true to only monitor running containers. This will result in Paused contaners being ignored.|\n|`DOCKER_SOCK=/var/run/docker.sock`    |Unix socket for curl requests to Docker API|\n|`CURL_TIMEOUT=30`                     |--max-time seconds for curl requests to Docker API|\n|`WEBHOOK_URL=\"\"`                      |post message to the webhook if a container was restarted (or restart failed)|\n\n## Testing (building locally)\n```bash\ndocker buildx build -t autoheal .\n\ndocker run -d \\\n    -e AUTOHEAL_CONTAINER_LABEL=all \\\n    -v /var/run/docker.sock:/var/run/docker.sock \\\n    autoheal\n```\n","funding_links":["https://github.com/sponsors/willfarrell"],"categories":["Container Operations","Shell","docker","HarmonyOS"],"sub_categories":["Monitoring","Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillfarrell%2Fdocker-autoheal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillfarrell%2Fdocker-autoheal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillfarrell%2Fdocker-autoheal/lists"}