Automatically update your Cloudflare DNS when your public IP changes
-
Create a Cloudflare API token with the following configuration
Permissions
- Zone - Zone - Read
- Zone - DNS - Edit
Zone Resources
- Include - All zones
-
Copy
config.json.template
to a new file namedconfig.json
Config Description Example cloudflare.apiToken
A Cloudflare API Token with the proper permissions XDX6YXn0MU2tpwJUa49UYLrtS5r4q-Ia9ng6H5Pu
zones.zoneId
The Zone ID of the domain you want to update DNS for gq3pvvxfr6x4fpfdgz7w7n4d3ckfk9pk
zones.recordNames
The name of each record you would like to update example.com
intervalSeconds
How often to check your DNS records (in seconds)1 300
1 Cloudflare's Rate Limits are pretty lenient, so feel free to set the interval as small as you want.
-
Run
cloudflare-ddns
using yourconfig.json
docker run \ -v /path/to/config.json:/app/config.json \ zachstence/cloudflare-ddns
version: "3.8" services: cloudflare-ddns: image: zachstence/cloudflare-ddns volumes: - /path/to/config.json:/app/config.json:ro restart: unless-stopped
- Accept file for Cloudflare API token to enable better security (Docker secrets)