How to update your Cloudflare DNS record with docker

I have a Synology NAS, I often need to access it when I am traveling, and I don’t have a Static IP – Static IP that requires network provider support and requires additional expenses. In this case I think it’s a good idea to use Dynamic DNS.

Dynamic DNS: Dynamic DNS (DDNS) is a method of automatically updating a name server in the Domain Name Server (DNS), often in real time.

We can find a lot of good free Dynamic DNS on the Internet. But one drawback is that they are usually only used for a few months. After the deadline, you need to manually update it, which is annoying. I know that I can’t ask too much for free resources, but I need to solve it once and for all.

Just as I have an unused domain name, my idea is to use Cloudflare’s domain name resolution service, and then use Cloudflare’s API to update my IP address in real time – whenever it changes.

If the domain provider you are using is not Cloudflare, you need to set the NameServers to [] and [].

The Docker image I chose is joshuaavalon/cloudflare-ddns, Of course you need to install Docker beforehand. If you have an Ubuntu server, you can refer to the Docker official website tutorial to install it. I am using Synology’s built-in Docker, which has a graphical interface that is easier to install and manage.

Linux Server Example:

docker run \
    -d \
    -e \
    -e \
    -e \
    -e API=1111111111111111 \
    -e TTL=1 \
    -e PROXY=false \

Synology Example:

For a description of each parameter, refer to the Parameters section of joshuaavalon/cloudflare-ddns. It should be noted that the PROXY option should not be set to True. If Cloudflare proxyes your IP address, it will result in failure to access the real IP address. The API Key can be found in Cloudflare’s API Tokens.

After the setting is over, you can ping the domain name to see if the IP address is correct. – It may take a while to synchronize the global DNS.

Leave a Reply

Your email address will not be published.