All Articles

Dynamic DNS With CloudFlare and Docker

Today I decided to finally get some Dynamic DNS (DDNS) up and running at home and as I use CloudFlare for my DNS on my domain(s) I went in search of a Docker container I could add to my Raspberry Pi 4. Luckily for us, a great container exists for this very purpose (thanks, oznu!)

Deploying The Container

I usually deploy via Docker Compose so that’s what I’ll outline first. Both of the below will do the same thing, however. I’ve pre-filled the environment fields here as an example so both of these assume that my API Key is 1234 and I want to update the ddns A record on the domain.

For your setup, you’ll need to update the API Key to the one generated via your CloudFlare Dashboard (giving it Edit DNS permissions on your chosen domain) and if you wanted to set up you’d set your ZONE to and SUBDOMAIN to home. The PROXIED field defines whether or not you want to proxy requests to your subdomain over CloudFlare’s CDN. Change this to “true” if you want to do that. (This can sometimes cause issues with certain pieces of software so you can always leave this unfiltered and if a specific piece of software needs the proxy, you can set up a CNAME record and filter that!)

Docker Compose

version: '2'
    image: oznu/cloudflare-ddns:latest
    restart: always
      - API_KEY=1234
      - SUBDOMAIN=ddns
      - PROXIED=false

Docker Run

docker run \
  -e API_KEY=1234 \
  -e \
  -e SUBDOMAIN=ddns \
  -e PROXIED=false \

Both of these will run across most ARM based SBC (Raspberry / Orange Pi, ASUS Tinkerboards, RockPi etc) and 64bit systems but if you have any issues, let me know in the comments and I’ll see if I can help!

This took me all of 5 minutes to get up and running and now I can have a constantly updated Dynamic DNS entry for my home network. You could use this to point CNAME records at for self-hosted projects, or even to ensure your NGINX Proxy Manager is always up-to-date on the correct IP.