ntfy config. for private docker registry.
2.6K
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.
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
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/...
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
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!
If you wish to modify the script or build the image yourself, follow these instructions.
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 .
| Variable | Description | Required? | Default |
|---|---|---|---|
NOTIFICATION_SERVICE_TYPE | The notification service to use. | Yes | ntfy |
DEBOUNCE_SECONDS | Seconds to wait before allowing another notification for the same image tag. | No | 10 |
NOTIFICATION_PRIORITY | Priority for ntfy/Gotify messages. Options: min, low, default, high, max. | No | default |
NTFY_SERVER_URL | The URL of your ntfy server. | If NOTIFICATION_SERVICE_TYPE is ntfy | |
NTFY_TOPIC | The ntfy topic to publish to. | If NOTIFICATION_SERVICE_TYPE is ntfy | |
NTFY_ACCESS_TOKEN | An optional access token for ntfy. | No | |
GOTIFY_SERVER_URL | The URL of your Gotify server. | If NOTIFICATION_SERVICE_TYPE is gotify | |
GOTIFY_APP_TOKEN | The application or client token for Gotify. | If NOTIFICATION_SERVICE_TYPE is gotify | |
DISCORD_WEBHOOK_URL | The full URL for your Discord webhook. | If NOTIFICATION_SERVICE_TYPE is discord |
Content type
Image
Digest
sha256:222c6a109…
Size
33.5 MB
Last updated
13 days ago
docker pull iamdockin/registry-webhook-receiver