Script and Docker container to update the IP address of a gandi.net domain.
- updates every hour (configurable)
- gets external IP address from icanhazip.com
- automatically skips update if external IP has not changed
- only 3.68 MB (compressed)
GANDI_API_KEY
: API key fromhttps://account.gandi.net/en/users/<your username>/security
DOMAIN
: domain name registered with gandi.net, for exampleexample.com
RECORD_NAMES
: name of the DNS records to update- specify multiple records by providing a comma-delimited list
- could be the name of the subdomain, for example,
foo
to update the IP forfoo.example.com
- could be
@
to update the IP for the domain itself
UPDATE_INTERVAL
: time interval between updates (optional)- defaults to
1h
(one hour) - must be in the format used by GNU
sleep
- defaults to
TIME_TO_LIVE
: DNS TTL, in seconds, for the record (optional)- defaults to
3600
(one hour)
- defaults to
export GANDI_API_KEY=12345
export DOMAIN=example.com
export RECORD_NAMES=foo,bar
./gandi-dynamic-dns
This will build, run, then remove the image. It should only be used for local testing.
docker run --rm -it -e 'GANDI_API_KEY=12345' -e 'DOMAIN=example.com' -e 'RECORD_NAMES=foo,bar' "$(docker build -q .)"
version: "3.7"
services:
gandi-dynamic-dns:
image: adamvig/gandi-dynamic-dns:latest
environment:
- GANDI_API_KEY=12345
- DOMAIN=example.com
- RECORD_NAMES=foo,bar