Diun Documentation

repository·master·Indexed 26 days ago

https://github.com/crazy-max/diun

Diun is a container image update watcher that monitors registries for new tags or digest changes and notifies users of available updates. It can be deployed as a single executable or a Docker image, connecting to various container platforms and configuration files to send notifications. The tool includes a CLI for managing image manifests, checking server health via gRPC, and testing notification settings.

Tokens
46K
Snippets
128
Records
258
Agent score
87%

What's inside Diun

  1. Overview of Diun (Docker Image Update Notifier)

    master

    Diun (Docker Image Update Notifier) is a tool designed to track container image updates automatically. It monitors registries on a schedule, detects changes in tracked tags or digests, and sends notifications when new versions are available. This is useful for monitoring upstream base image rebuilds and application releases.

    Diun can be deployed as a single executable binary or as a Docker image.

  2. Overview of Diun

    master

    Diun is a tool that watches container images and notifies you when an update is available. It monitors registries for new tags or digest changes, allowing you to track base image updates, application releases, and security rebuilds automatically.

    Diun can be deployed as:

    • A single executable.
    • A Docker image.

    It is designed to connect to container platforms and configuration files and send notifications through various supported services.

  3. Configuration precedence and defaults

    master

    Diun evaluates configuration in the following order:

    1. Configuration file (diun.yml or diun.yaml)
    2. Environment variables

    If a value is not provided for an option, a default value is applied. If an option has sub-options and only some are specified, the remaining sub-options will use their respective default values.

    Note: Setting a top-level environment variable for a provider (e.g., DIUN_PROVIDERS_DOCKER) will enable that provider and reset all its sub-options to their default values.

  4. Key features of Diun

    master

    Diun provides the following capabilities:

    • Image Tracking: Watch container images and report changes in tags or digests.
    • Filtering: Use include and exclude filters for specific tags when tracking repositories.
    • Scheduling: Run checks on a built-in schedule without requiring external cron jobs.
    • Multi-Provider Support: Discover images from various sources including:
      • Docker
      • Containerd
      • Kubernetes
      • Swarm
      • Nomad
      • Dockerfile
      • File
    • Customization: Override target image OS and architecture.
    • Notifications: Send alerts via Gotify, Mail, Slack, Telegram, and other services.
    • Monitoring: Integrate with Healthchecks to monitor the status of the Diun watcher itself.
    • Logging: Detailed logging for checks, updates, and notification delivery status.
  5. Set up the Containerd provider

    master

    The Containerd provider analyzes containers via the containerd gRPC API socket to extract images and check for registry updates.

    To use Diun with Containerd via Docker, you must mount the containerd socket into the Diun container.

    Example minimal configuration for a local containerd instance using the default namespace:

    watch:
      workers: 20
      schedule: "0 */6 * * *"
    
    providers:
      containerd: {}

    Example Docker Compose service definition:

    services:
      diun:
        image: crazymax/diun:latest
        command: serve
        volumes:
          - "./data:/data"
          - "/run/containerd/containerd.sock:/run/containerd/containerd.sock"
          - "./diun.yml:/diun.yml:ro"
        environment:
          - "TZ=Europe/Paris"
          - "LOG_LEVEL=info"
        restart: always
  6. Resolve registry 'too many requests' (429) errors

    master

    To resolve too many requests to registry errors (HTTP 429), authenticate against the registry using the regopts settings. If rate limits persist, increase the interval between scans by adjusting the schedule setting (e.g., to every 6 hours).

    regopts:
      - name: "docker.io"
        selector: image
        username: foo
        password: bar
  7. Manage images in the Diun database

    master

    The following commands allow you to interact with the images stored in the Diun database. Note: These commands require the Diun server to be running via the serve command.

    List images

    List all images currently in the database.

    • --raw: JSON output.
    • --grpc-authority <string>: Link to Diun gRPC API (default 127.0.0.1:42286).

    Inspect an image

    Display detailed information for a specific image.

    • --image <name>: Required. The image to inspect.
    • --raw: JSON output.
    • --grpc-authority <string>: Link to Diun gRPC API (default 127.0.0.1:4226).

    Remove an image

    Remove an image manifest from the database.

    • --image <name>: Required. The image to remove. If no tag is specified, all manifests for that image will be removed.
    • --grpc-authority <string>: Link to Diun gRPC API (default 127.0.0.1:42286).

    Prune images

    Remove all manifests from the database.

    • --force: Do not prompt for confirmation.
    • --grpc-authority <string>: Link to Diun gRPC API (default 127.0.0.1:42286).
  8. Run Diun behind an HTTP proxy

    master

    To route registry checks or notification requests through a proxy (like Squid), set the standard environment variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY in the Diun container.

    Note: These settings apply to the Diun process inside the container, not the Docker daemon itself. Use NO_PROXY for local services or private registries that should be contacted directly.

    services:
      diun:
        image: crazymax/diun:latest
        environment:
          - "HTTP_PROXY=http://squid.local:3128"
          - "HTTPS_PROXY=http://squid.local:3128"
          - "NO_PROXY=localhost,127.0.0.1,::1"
        # ... other config
  9. Configure Microsoft Teams notifications

    master

    You can send Diun notifications to a Microsoft Teams channel using either an incoming webhook URL or a Microsoft Teams Workflows webhook URL.

    To configure this, add a teams section under notif in your configuration file. You can specify the webhookURL, the cardType (either messageCard or adaptiveCard), and customize the message using templateBody.

    If you are using a webhook URL created via the Teams Workflows app, you must set cardType to adaptiveCard.

    notif:
      teams:
        webhookURL: https://outlook.office.com/webhook/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
        cardType: messageCard
        renderFacts: true
        templateBody: |
          Docker tag {{ .Entry.Image }} which you subscribed to through {{ .Entry.Provider }} provider has been released.