mirror of
https://github.com/willfarrell/docker-autoheal.git
synced 2024-12-06 19:16:20 +01:00
37 lines
1.5 KiB
Markdown
37 lines
1.5 KiB
Markdown
# docker-autoheal
|
|
|
|
Monitor and restart unhealthy docker containers.
|
|
This functionality was propose 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` https://github.com/docker/docker/pull/22719.
|
|
|
|
## Supported tags and Dockerfile links
|
|
- [`latest` (*Dockerfile*)](https://github.com/willfarrell/docker-autoheal/blob/master/Dockerfile)
|
|
|
|
[](http://microbadger.com/images/willfarrell/autoheal "Get your own version badge on microbadger.com") [](http://microbadger.com/images/willfarrell/autoheal "Get your own image badge on microbadger.com")
|
|
|
|
## How to use
|
|
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.
|
|
|
|
## ENV Defaults
|
|
```
|
|
AUTOHEAL_CONTAINER_LABEL=autoheal
|
|
AUTOHEAL_INTERVAL=5
|
|
DOCKER_SOCK=/var/run/docker.sock
|
|
```
|
|
|
|
## Testing
|
|
```bash
|
|
docker build -t autoheal .
|
|
|
|
docker run -d \
|
|
-e AUTOHEAL_CONTAINER_LABEL=all \
|
|
-v /var/run/docker.sock:/var/run/docker.sock \
|
|
autoheal
|
|
```
|