Skip to content

Cloudflare DDNS setup

Abhilesh Dhawanjewar edited this page Feb 9, 2022 · 3 revisions

Use Cloudflare's free DNS Service as a Dynamic DNS Provider (DDNS) to keep your domain name pointing at the correct IP address for dynamic public IPs.

Create Cloudflare API token

  • Log into the Cloudflare Dashboard and go to User Profile --> API Tokens (Direct Link)

  • From the API Token home screen create Create Token.

  • Select Custom Token and enter the following in the respective fields

    • Permissions
    Zone Zone Settings Read
    Zone Zone Read
    Zone DNS Edit
    • Zone Resources
    Include All zones from an account Select Account
  • The filled out form should look like so -

  • The summary of the newly minted API token follows on the next page -

Setup docker container for Cloudflare-DDNS

Save the following as docker-compose.yml -

version: '2'
services:
  cloudflare-ddns:
    container_name: cloudflare-ddns
    image: oznu/cloudflare-ddns:latest
    restart: always
    environment:
      - API_KEY=XXXXXXXXXXXXXXXXXXXXX            # Change to your cloudflare API token (https://developers.cloudflare.com/api/tokens/create)
      - ZONE=domain.com                          # Change to your domain
      - PROXIED=true
      - PUID=1000                                # Change this
      - PGID=1000                                # Change this

Open a terminal in the same directory and start the docker container -

docker-compose up -d
Clone this wiki locally