Skip to main content

ntfy (Push Notification Service)

What this is

A lightweight self-hosted push notification service that allows sending alerts to devices via HTTP, scripts, or apps.


Why I set this up

I wanted a simple way to:

  • Receive alerts from my homelab (containers, scripts, failures)
  • Integrate notifications with automation tools
  • Avoid relying on third-party notification services

Where it runs


Docker Compose

services:
ntfy:
image: binwiederhier/ntfy:latest
container_name: ntfy
command:
- serve
- --config
- /etc/ntfy/server.yml

environment:
- TZ=Europe/London

volumes:
- ./cache:/var/cache/ntfy
- ./auth:/var/lib/ntfy
- ./config/server.yml:/etc/ntfy/server.yml

ports:
- 6741:80

restart: unless-stopped


Key Configuration Notes

Network

  • Uses bridge networking
  • Accessible via port 6741
  • No special networking requirements

Storage

  • ./cache → message cache and attachments
  • ./auth → user authentication data
  • ./config/server.yml → main configuration file

👉 All stored under:

/opt/docker/ntfy/


Special Config

  • Custom config file:
    • /etc/ntfy/server.yml
  • Timezone set via TZ
  • Optional:
    • Authentication
    • Access control
    • Rate limiting

Setup Steps

  1. Create folder:
mkdir -p /opt/docker/ntfy/{cache,auth,config}
cd /opt/docker/ntfy

  1. Create config file:
nano config/server.yml

  1. Add basic config (example):
base-url: "http://192.168.86.100:6741"
listen-http: ":80"
cache-file: "/var/cache/ntfy/cache.db"
auth-file: "/var/lib/ntfy/auth.db"

  1. Create compose file:
nano docker-compose.yml

  1. Start container:
docker compose up -d


Problems / Fixes

Cannot access web UI

  • Cause: Container not running or wrong port
  • Fix:
docker ps
docker compose restart


Notifications not received

  • Cause: Incorrect topic or URL
  • Fix:
  • Verify:
http://SERVER_IP:6741/<topic>


Config changes not applied

  • Cause: Container not restarted
  • Fix:
docker compose restart


Permission issues

  • Cause: Incorrect folder ownership
  • Fix:
sudo chown -R 1000:1000 /opt/docker/ntfy


Result

  • ntfy accessible via browser
  • Can send notifications via:
    • curl
    • scripts
    • apps
  • Persistent storage for messages and auth

Notes

  • Works great with:
    • cron jobs
    • Docker monitoring (e.g. DIUN)
    • Home Assistant automations
  • Can be exposed externally later via reverse proxy if needed
  • Keep config backed up (part of /opt/docker)
  • Topics are created dynamically — no setup required