Skip to content

zachstence/cloudflare-ddns

Repository files navigation

cloudflare-ddns

Automatically update your Cloudflare DNS when your public IP changes

license mit
docker pulls docker size
wakatime

Table of Contents

Usage

  1. Create a Cloudflare API token with the following configuration

    docs/permissions.png

    Permissions

    • Zone - Zone - Read
    • Zone - DNS - Edit

    Zone Resources

    • Include - All zones
  2. Identify your Cloudflare Zone ID

    docs/zone-id.png

  3. Copy config.json.template to a new file named config.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.

  4. Run cloudflare-ddns using your config.json

    Run using Docker

    docker run \
        -v /path/to/config.json:/app/config.json \
        zachstence/cloudflare-ddns

    Run using docker-compose

    version: "3.8"
    
    services:
    cloudflare-ddns:
        image: zachstence/cloudflare-ddns
        volumes:
        - /path/to/config.json:/app/config.json:ro
        restart: unless-stopped

Future Features

  • Accept file for Cloudflare API token to enable better security (Docker secrets)