Watchdog for Docker is a Docker image which provides (at the moment) just a simple watchdog to automatically restart unhealthy containers. Some more functions to monitor your containers will follow.
To let the watchdog watch your running containers and automatically restart them when "unhealthy" status is detectet just run it like this:
docker run \ -d \ --name watchdog \ --restart=always \ -e WATCHDOG_CONTAINER_LABEL=all \ -v /var/run/docker.sock:/var/run/docker.sock \ buanet/watchdog:latest
You can also run the watchdog by using docker-compose. Here is an example:
version: '2' services: watchdog: container_name: watchdog image: buanet/watchdog:latest hostname: watchdog restart: always environment: - WATCHDOG_CONTAINER_LABEL=all volumes: - /var/run/docker.sock:/var/run/docker.sock
The following will give a short overview.
To configure the watchdog you can set some environment variables. You do not have to declare every single variable when setting up your container. Variables you do not set will come up with their default value.
|WATCHDOG_CONTAINER_LABEL||watchdog||Defines a label name the watchdog is looking for. If it finds a container with this lable set to "true" it will watch it. To watch all cntainers on the host the watchdog is running on set it to "all"|
If you want to get the newest features and changes feel free to use/ test the beta version of the Docker image. You can find the readme.md file for beta versions here. Please make sure to read the changelog before testing beta versions.
There are some more watchdog features planned e.g.
The easiest way to support this project is to leave me some likes/ stars on Github and Docker hub!
If you want to give something back, feel free to take a look into the open issues and helping me answering questions, fixing bugs or adding new features!
And if you want to buy me a beer instead, you can do this here:
Copyright (c) 2020 [Andr Germann]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.