Sign inSign up

iamdockin/registry-webhook-receiver

By iamdockin

Updated 13 days ago

ntfy config. for private docker registry.

Image
Integration & delivery
0

2.6K

iamdockin/registry-webhook-receiver repository overview

Docker Registry Notifier

A lightweight, webhook receiver to get notifications from your private Docker Registry. It listens for image push events and sends clean, debounced alerts to your favourite notification service.

This image is designed to be used alongside the official registry:3 image.

Key Features

  • Multiple Notification Services: Supports ntfy, Gotify, and Discord out of the box.
  • Debounced Notifications: Intelligently groups multiple push events for a single image tag into one notification, preventing alert spam.
  • Lightweight & Secure: Built using multi-stage Docker builds for a minimal final image size and runs as a non-root user for enhanced security.

Getting Started

Step 1: Configure Your Docker Registry

Your Docker Registry needs to be configured to send webhook notifications to this service. Add the notifications section to your registry's config.yml.

Example config.yml:

version: 0.1
log:
  level: info
  formatter: text
storage:
  filesystem:
    rootdirectory: /var/lib/registry
  delete:
    enabled: true
http:
  addr: :5000
  secret: "a-very-secure-secret-string" # Replace with your own secret
notifications:
  endpoints:
    - name: "notifier"
      url: "http://registry-notifier:5001/notify" # The URL points to our service
      timeout: 5s
      threshold: 1 # Send notification after 1 event
      backoff: 10s
Step 2: Prepare the Notifier Configuration

Create a .env file to store your configuration secrets and settings. This is more secure than placing them directly in the docker-compose.yml file.

Example .env file:

# The same secret used in your registry's config.yml
REGISTRY_HTTP_SECRET="a-very-secure-secret-string"

# --- CORE NOTIFIER SETTINGS ---
# Choose ONE service: "ntfy", "gotify", or "discord"
NOTIFICATION_SERVICE_TYPE=ntfy

# Cooldown period in seconds to prevent duplicate notifications for the same image tag.
DEBOUNCE_SECONDS=10

# --- NOTIFICATION PRIORITY ---
# Options: min, low, default, high, max
NOTIFICATION_PRIORITY=default

# --- NTFY SETTINGS (if using ntfy) ---
NTFY_SERVER_URL=https://ntfy.sh
NTFY_TOPIC=my_registry_events
NTFY_ACCESS_TOKEN= # Optional: your_ntfy_access_token

# --- GOTIFY SETTINGS (if using gotify) ---
GOTIFY_SERVER_URL= # https://your-gotify-instance.com
GOTIFY_APP_TOKEN= # your_gotify_app_token

# --- DISCORD SETTINGS (if using discord) ---
DISCORD_WEBHOOK_URL= # https://discord.com/api/webhooks/...
Step 3: Create the Docker Compose File

This docker-compose.yml will run both your Docker Registry and the new notifier service.

Example docker-compose.yml:


networks:
  registry-net:
    driver: bridge

services:
  # --- Docker Registry ---
  registry:
    image: registry:3
    container_name: registry_service
    restart: unless-stopped
    volumes:
      - ./data:/var/lib/registry
      - ./config.yml:/etc/docker/registry/config.yml:ro
    networks:
      - registry-net
    environment:
      REGISTRY_HTTP_SECRET: ${REGISTRY_HTTP_SECRET} # Loaded from .env file

  # --- Notification Service ---
  registry-notifier:
    # Replace with your own image if you build it yourself
    image: iamdockin/registry-webhook-receiver:latest
    container_name: registry-notifier
    restart: unless-stopped
    networks:
      - registry-net
    # The .env file in the same directory will be loaded automatically
    env_file: .env
Step 4: Launch the Services

With your config.yml, .env, and docker-compose.yml files in the same directory, simply run:

docker-compose up -d

Your registry is now running and will send notifications via the notifier service whenever a new image is pushed!

Building The Image Yourself

If you wish to modify the script or build the image yourself, follow these instructions.

Building for a Single Architecture
docker build -t your-username/registry-notifier:latest .

To build for both amd64 and arm64, you must use docker buildx and push the result directly to a registry.

# This command builds for both platforms and pushes the manifest to your registry
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  -t your-username/registry-notifier:latest \
  --push .

Configuration Environment Variables

VariableDescriptionRequired?Default
NOTIFICATION_SERVICE_TYPEThe notification service to use.Yesntfy
DEBOUNCE_SECONDSSeconds to wait before allowing another notification for the same image tag.No10
NOTIFICATION_PRIORITYPriority for ntfy/Gotify messages. Options: min, low, default, high, max.Nodefault
NTFY_SERVER_URLThe URL of your ntfy server.If NOTIFICATION_SERVICE_TYPE is ntfy
NTFY_TOPICThe ntfy topic to publish to.If NOTIFICATION_SERVICE_TYPE is ntfy
NTFY_ACCESS_TOKENAn optional access token for ntfy.No
GOTIFY_SERVER_URLThe URL of your Gotify server.If NOTIFICATION_SERVICE_TYPE is gotify
GOTIFY_APP_TOKENThe application or client token for Gotify.If NOTIFICATION_SERVICE_TYPE is gotify
DISCORD_WEBHOOK_URLThe full URL for your Discord webhook.If NOTIFICATION_SERVICE_TYPE is discord

Tag summary

Content type

Image

Digest

sha256:222c6a109

Size

33.5 MB

Last updated

13 days ago

docker pull iamdockin/registry-webhook-receiver