Small Dockerized shell updater for Hetzner DNS (Cloud API).
Supports multiple zones and multiple hosts per zone.
- Docker + Docker Compose
- Hetzner Cloud API token with DNS access
- Zones already exist in Hetzner DNS
git clone https://github.com/spacecake/hcloud-dyndns.git
cd hcloud-dyndns
cp .env.example .env
# edit .env and set API_TOKEN=...
cp config/hcloud-zones.example.txt config/hcloud-zones.txt
# edit config/hcloud-zones.txt with your zones/hosts (local only)
docker compose up -d --build
docker compose logs -fIf you need a one-shot run, do it without an extra service:
docker compose run --rm -e MODE=once hcloud-dyndns
(Optionally add -e SCRIPT_FLAGS=--quiet.)
Hosts are space-separated.
Use FQDNs (recommended).
If you put only the zone on a line, the script updates the zone apex.
config/hcloud-dyndns.conf
Default updates A only
IPV6=1 updates AAAA only
BOTH=1 updates A + AAAA
Set these in docker-compose.yml under environment: (or via docker compose run -e ...).
-
AUTO_CREATE=0|1If 1, missing RRsets will be created automatically (uses add_records). -
TTL=3600Enforces RRset TTL (default: 3600). Script will change TTL if different.
Set in docker-compose.yml:
INTERVAL=300(default) = every 5 minutes
Default behavior: logs only when something changes ([SET] / [UPD] / [TTL]) or on errors ([ERR]).
Enable verbose logs ([OK] too) by adding to docker-compose.yml:
- SCRIPT_FLAGS=--verbose
- SCRIPT_FLAGS=--quiet
One-shot run (no extra service)
docker compose run --rm -e MODE=once hcloud-dyndns
Example (verbose + auto-create + TTL):
docker compose run --rm -e MODE=once -e SCRIPT_FLAGS=--verbose -e AUTO_CREATE=1 -e TTL=3600 hcloud-dyndns
git pull
docker compose up -d --build