A small Docker image that allows you to use CloudFlare as a DDNS / DynDNS Provider.
351
This small Alpine Linux based Docker image will allow you to use the free CloudFlare DNS Service as a Dynamic DNS Provider (DDNS).
This is a multi-arch image and will run on amd64, aarch64, and armhf devices, including the Raspberry Pi.
Quick Setup:
docker run \
-e API_KEY=<apikey> \
-e ZONE=<mydomain> \
-e SUBDOMAIN=@,www \
ghcr.io/rycochet/docker-cloudflare-ddns:latest
If you prefer to use Docker Compose:
services:
cloudflare-ddns:
image: ghcr.io/rycochet/docker-cloudflare-ddns:latest
restart: always
environment:
- API_KEY=<apikey>
- ZONE=<mydomain>
- SUBDOMAIN=@,www
| Name | Definition | Default |
|---|---|---|
API_KEY or API_KEY_FILE 1 | Required Your CloudFlare scoped API token. See Creating a Cloudflare API token below. | |
ZONE or ZONE_FILE 1 | Required The DNS Zone (domain name) that DDNS updates should be applied to. | |
SUBDOMAIN or SUBDOMAIN_FILE 1 | One or more comma separated subdomains of the ZONE to write DNS changes to. @ will update the root zone. * will update the wildcard subdomain. | @ |
CRON | Set your own custom CRON value for how often this runs. | */5 * * * * (every 5 minutes) |
CUSTOM_LOOKUP_CMD | A shell command to run that must print the IP on the standard output. | |
DELETE_ON_STOP | Delete the DNS record when the container is stopped. | false |
DNS_SERVER | The IP address of the DNS server for automatic DNS lookups should ipify fail. | 1.1.1.1 |
EMAIL | Deprecated Your CloudFlare email address when using an Account-level token. This variable MUST NOT be set when using a scoped API token. | |
INTERFACE | Set to tun0 to have the IP pulled from a network interface named tun0. If this is not supplied the public IP will be used instead. Requires --network host run argument. | |
PROXIED | Make traffic go through the CloudFlare CDN. | false |
RRTYPE | DNS record type: A for IPv4. AAAA for IPv6 (you will also need to run docker with IPv6 support, or run the container with host networking enabled). | A |
WEBHOOK_URL | Set to a webhook URL to send a message when the IP address changes. |
The image is based on an alpine OS with S6 supervisor and the s6-overlay architecture.
It will find out the DNS address to use, then for each requested subdomain it will check if it needs to update, and only change if needed.
This runs (by default) every 5 minutes using cron. The default TTL (Auto) on Cloudflare is 5 minutes, so records are updated about as quickly as possible.
To create a CloudFlare API token for your DNS zone go to https://dash.cloudflare.com/profile/api-tokens and follow these steps:
Create Token.Edit zone DNS Template.cloudflare-ddns.Zone - DNS - Edit).Include - All zonesContinue to summary, then Create Token.API_KEY variable.If you need multiple records pointing to your public IP address you can create CNAME records in CloudFlare, or run multiple instances of the image with different options.
linux/386linux/amd64linux/arm/v6linux/arm/v7linux/arm64linux/ppc64lelinux/riscv64linux/s390xCopyright (C) 2017-2025 oznu (original developer until 2020), two70, TThanhXuan, VSF1, sachasmart, enstyrka, aaronbolton, ian-otto, giorginogreg, Rycochet
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Content type
Image
Digest
sha256:7e22081a1…
Size
24.3 MB
Last updated
over 1 year ago
docker pull rycochet/docker-cloudflare-ddns