Docker Tag Checker with Notifications
Find a file
2024-11-16 11:17:07 +01:00
.gitignore init 2024-11-16 01:03:41 +01:00
check_docker_tags.sh split into more functions 2024-11-16 11:17:07 +01:00
config_example init 2024-11-16 01:03:41 +01:00
LICENSE init 2024-11-16 01:03:41 +01:00
README.md init 2024-11-16 01:03:41 +01:00

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

  1. Dependencies:

    • curl: For API requests and notifications.
    • jq: For parsing JSON responses.

    Install via:

    sudo apt update
    sudo apt install curl jq
    
  2. Permissions:

    • Ensure the script has execution permissions:
      chmod +x check_docker_tags.sh
      
  3. GitHub Personal Access Token:

    • A token with the read:packages permission is required for GitHub API access.
    • Add the token to the configuration file under the ghcr_token key.

Installation

  1. Clone the repository or copy the script to your local machine.
  2. 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 format owner/repo.
  • filter: Pipe-separated list of keywords to ignore in tags.

Usage

Run the script:

./check_docker_tags.sh

Behavior

  1. On the first run:

    • Detects the latest tag for each project and stores it locally.
    • Sends a notification for the detected tag.
  2. On subsequent runs:

    • Compares the latest tag with previously known tags.
    • Sends a notification only for new tags.

Debugging

Common Issues

  1. Configuration File Not Found:

    • Ensure the configuration file is named config and located in the same directory as the script.
  2. Permission Denied:

    • Ensure the known_tags directory and files are writable:
      chmod -R u+w known_tags
      
  3. Missing Dependencies:

    • Ensure curl and jq are installed.

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.