Docker Tag Checker with Notifications
| .gitignore | ||
| check_docker_tags.sh | ||
| config_example | ||
| LICENSE | ||
| README.md | ||
Docker Tag Checker with Notifications
This script monitors Docker repositories and GitHub repositories for new tags and sends notifications via ntfy.
Features
- Monitors Docker repositories for new tags using Docker Hub API.
- Monitors GitHub repositories for new tags using GitHub API.
- Sends notifications for newly discovered tags using ntfy.
- Saves known tags locally to avoid duplicate notifications.
Requirements
-
Dependencies:
curl: For API requests and notifications.jq: For parsing JSON responses.
Install via:
sudo apt update sudo apt install curl jq -
Permissions:
- Ensure the script has execution permissions:
chmod +x check_docker_tags.sh
- Ensure the script has execution permissions:
-
GitHub Personal Access Token:
- A token with the
read:packagespermission is required for GitHub API access. - Add the token to the configuration file under the
ghcr_tokenkey.
- A token with the
Installation
- Clone the repository or copy the script to your local machine.
- Create the configuration file:
cp config_example config
Configuration
The configuration file (config) should be structured as follows:
General Settings
# ntfy server URL and topic
ntfy_server=https://ntfy.yourdomain.com/
ntfy_topic=docker-updates
# GitHub Personal Access Token
ghcr_token=your_github_personal_access_token
Projects to Monitor
Each project is defined in its own section:
[lemmy]
docker_hub=dockurr/lemmy
filter=latest|beta
[authentik]
github_repo=goauthentik/authentik
filter=rc|alpha
url: Docker Hub API URL for the repository.github_repo: GitHub repository in the formatowner/repo.filter: Pipe-separated list of keywords to ignore in tags.
Usage
Run the script:
./check_docker_tags.sh
Behavior
-
On the first run:
- Detects the latest tag for each project and stores it locally.
- Sends a notification for the detected tag.
-
On subsequent runs:
- Compares the latest tag with previously known tags.
- Sends a notification only for new tags.
Debugging
Common Issues
-
Configuration File Not Found:
- Ensure the configuration file is named
configand located in the same directory as the script.
- Ensure the configuration file is named
-
Permission Denied:
- Ensure the
known_tagsdirectory and files are writable:chmod -R u+w known_tags
- Ensure the
-
Missing Dependencies:
- Ensure
curlandjqare installed.
- Ensure
Example Output
Checking tags for lemmy...
New tag found for lemmy: 0.19.6
Checking tags for authentik...
Latest tag (2024.10.2) is already known.
License
This project is licensed under the AGPL-3.0 License. See the LICENSE file for details.