A feature-rich and robust Cloudflare DDNS updater with a small footprint. The program will detect your machine's public IP addresses and update DNS records using the Cloudflare API.
www.a.org, hello.io) without knowing their DNS zones.🐱.example.org and 日本。co。jp) are fully supported.*.example.org) are also supported.A records) and IPv6 (AAAA records) for each domain.By default, public IP addresses are obtained via Cloudflare debugging page. This minimizes the impact on privacy because we are already using the Cloudflare API to update DNS records. Moreover, if Cloudflare servers are not reachable, chances are you cannot update DNS records anyways.
🛡️ The updater uses only HTTPS or DNS over HTTPS to detect IP addresses. This makes it harder for someone else to trick the updater into updating your DNS records with wrong IP addresses. See the Security Model for more information.
cosign verify favonia/cloudflare-ddns:latest \ --certificate-identity-regexp https://github.com/favonia/cloudflare-ddns/ \ --certificate-oidc-issuer https://token.actions.githubusercontent.com
Note: this only proves that a Docker image is from this repository. It cannot prevent malicious code if someone hacks into GitHub or this repository.
(Click to expand the following items.)
<details><summary>🐋 Directly run the Docker image.</summary></details> <details><summary>🧬 Directly run the updater from its source.</summary>docker run \ --network host \ -e CF_API_TOKEN=YOUR-CLOUDFLARE-API-TOKEN \ -e DOMAINS=example.org,www.example.org,example.io \ -e PROXIED=true \ favonia/cloudflare-ddns:latest
You need the Go tool to run the updater from its source.
</details>CF_API_TOKEN=YOUR-CLOUDFLARE-API-TOKEN \ DOMAINS=example.org,www.example.org,example.io \ PROXIED=true \ go run github.com/favonia/cloudflare-ddns/cmd/ddns@latest
Incorporate the following fragment into the compose file (typically docker-compose.yml or docker-compose.yaml). The template may look a bit scary, but only because it includes various optional flags for extra security protection.
services: cloudflare-ddns: image: favonia/cloudflare-ddns:latest # Choose the appropriate tag based on your need: # - "latest" for the latest stable version (which could become 2.x.y # in the future and break things) # - "1" for the latest stable version whose major version is 1 # - "1.x.y" to pin the specific version 1.x.y network_mode: host # This bypasses network isolation and makes IPv6 easier (optional; see below) restart: always # Restart the updater after reboot user: "1000:1000" # Run the updater with specific user and group IDs (in that order). # You can change the two numbers based on your need. read_only: true # Make the container filesystem read-only (optional but recommended) cap_drop: [all] # Drop all Linux capabilities (optional but recommended) security_opt: [no-new-privileges:true] # Another protection to restrict superuser privileges (optional but recommended) environment: - CF_API_TOKEN=YOUR-CLOUDFLARE-API-TOKEN # Your Cloudflare API token - DOMAINS=example.org,www.example.org,example.io # Your domains (separated by commas) - PROXIED=true # Tell Cloudflare to cache webpages and hide your IP (optional)
(Click to expand the following important tips.)
<details> <summary>🔑 <code>CF_API_TOKEN</code> is your Cloudflare API token</summary>The value of CF_API_TOKEN should be an API token (not an API key), which can be obtained from the API Tokens page. (The less secure API key authentication is deliberately not supported.)
You can also grant new permissions to existing tokens at any time!
</details> <details> <summary>📍 <code>DOMAINS</code> is the list of domains to update</summary>The value of DOMAINS should be a list of fully qualified domain names (FQDNs) separated by commas. For example, DOMAINS=example.org,www.example.org,example.io instructs the updater to manage the domains example.org, www.example.org, and example.io. These domains do not have to be in the same zone---the updater will identify their zones automatically.
The setting PROXIED=true instructs Cloudflare to cache webpages and hide your IP addresses. If you wish to bypass that and expose your actual IP addresses, remove PROXIED=true. If your traffic is not HTTP(S), then Cloudflare cannot proxy it and you should probably turn off the proxying by removing PROXIED=true. The default value of PROXIED is false.
The updater, by default, will attempt to update DNS records for both IPv4 and IPv6, and there is no harm in leaving the automatic detection on even if your network does not work for one of them. However, if you want to disable IPv6 entirely (perhaps to avoid all the detection errors), add the setting IP6_PROVIDER=none.
The easiest way to enable IPv6 is to use network_mode: host so that the updater can access the host IPv6 network directly. This has the downside of bypassing the network isolation. If you wish to keep the updater isolated from the host network, remove network_mode: host and follow the steps in the official Docker documentation to enable IPv6. Use newer versions of Docker that come with (much) better IPv6 support.
Change 1000:1000 to USER:GROUP for the USER and GROUP IDs you wish to use to run the updater. The settings cap_drop, read_only, and no-new-privileges in the template provide additional protection, especially when you run the container as a non-superuser.
docker-compose pull cloudflare-ddns docker-compose up --detach --build cloudflare-ddns
(Click to expand the following items.)
<details> <summary>😠 I simulated an IP address change by editing the DNS records, but the updater never picked it up!</summary>Please rest assured that the updater is working as expected. It will update the DNS records immediately for a real IP change. Here is a detailed explanation. There are two causes of an IP mismatch:
The updater assumes no one will actively change the DNS records. In other words, it assumes simulated changes will not happen. It thus caches the DNS records and cannot detect your simulated changes. However, when your actual IP address changes, the updater will immediately update the DNS records. Also, the updater will eventually check the DNS records and detect simulated changes after CACHE_EXPIRATION (six hours by default) has passed.
If you really wish to test the updater with simulated IP changes in the DNS records, you can set CACHE_EXPIRATION=1ns (all cache expiring in one nanosecond), effectively disabling the caching. However, it is recommended to keep the default value (six hours) to reduce your network traffic.
Is your “public” IP address on your router between 100.64.0.0 and 100.127.255.255? If so, you are within your ISP’s CGNAT (Carrier-grade NAT). In practice, there is no way for DDNS to work with CGNAT, because your ISP does not give you a real public IP address, nor does it allow you to forward IP packages to your router using cool protocols such as Port Control Protocol. You have to give up DDNS or switch to another ISP. You may consider other services such as Cloudflare Tunnel that can work around CGNAT.
(Click to expand the following items.)
<details> <summary>🔑 The Cloudflare API token</summary>| Name | Valid Values | Meaning | Required? | Default Value |
|---|---|---|---|---|
CF_API_TOKEN | Cloudflare API tokens | The token to access the Cloudflare API | Exactly one of CF_API_TOKEN and CF_API_TOKEN_FILE should be set | N/A |
CF_API_TOKEN_FILE | Paths to files containing Cloudflare API tokens | A file that contains the token to access the Cloudflare API | Exactly one of CF_API_TOKEN and CF_API_TOKEN_FILE should be set | N/A |
| Name | Valid Values | Meaning | Required? | Default Value |
|---|---|---|---|---|
DOMAINS | Comma-separated fully qualified domain names or wildcard domain names | The domains the updater should manage for both A and AAAA records | (See below) | (empty list) |
IP4_DOMAINS | Comma-separated fully qualified domain names or wildcard domain names | The domains the updater should manage for A records | (See below) | (empty list) |
IP6_DOMAINS | Comma-separated fully qualified domain names or wildcard domain names | The domains the updater should manage for AAAA records | (See below) | (empty list) |
<details> <summary>📍 At least one of <code>DOMAINS</code>, <code>IP4/6_DOMAINS</code>, and <code>WAF_LISTS</code> must be non-empty.</summary>At least something should be listed in
</details>DOMAINS,IP4_DOMAINS,IP6_DOMAINS, orWAF_LISTS(for WAF lists, see below). Otherwise, if all of them are empty, then the updater has nothing to do. It is fine to list the same domain in bothIP4_DOMAINSandIP6_DOMAINS, which is equivalent to listing it inDOMAINS. Internationalized domain names are supported using the non-transitional processing fully compatible with IDNA2008. See this useful FAQ on internationalized domain names.
<details> <summary>🃏 What are wildcard domains?</summary></details> <details> <summary>🔍 IP address providers</summary>Wildcard domains (
</details>*.example.org) represent all subdomains that would not exist otherwise. Therefore, if you have another subdomain entrysub.example.org, the wildcard domain is independent of it, because it only represents the other subdomains which do not have their own entries. Also, you can only have one layer of*---*.*.example.orgwould not work.
| Name | Valid Values | Meaning | Required? | Default Value |
|---|---|---|---|---|
IP4_PROVIDER | cloudflare.doh, cloudflare.trace, local, url:URL, or none | How to detect IPv4 addresses, or none to disable IPv4 (see below) | No | cloudflare.trace |
IP6_PROVIDER | cloudflare.doh, cloudflare.trace, local, url:URL, or none | How |


AI一键生成PPT,就用博思AIPPT!
博思AIPPT,新一代的AI生成PPT平台,支持智能生成PPT、AI美化PPT、文本&链接生成PPT、导入Word/PDF/Markdown文档生成PPT等,内置海量精美PPT模板,涵盖商务、教育、科技等不同风格,同时针对每个页面提供多种版式,一键自适应切换,完美适配各种办公场景。


AI赋能电商视觉革命,一站式智能商拍平台
潮际好麦深耕服装行业,是国内AI试衣效果最好的软件。使用先进AIGC能力为电商卖家批量提供优质的、低成本的商拍图。合作品牌有Shein、Lazada、安踏、百丽等65个国内外头部品牌,以及国内10万+淘宝、天猫、京东等主流平台的品牌商家,为卖家节省将近85%的出图成本,提升约3倍出图效率,让品牌能够快速上架。


企业专属的AI法律顾问
iTerms是法大大集团旗下法律子品牌,基于最先进的大语言模型(LLM)、专业的法律知识库和强大的智能体架构,帮助企业扫清合规障碍,筑牢风控防线,成为您企业专属的AI法律顾问。


稳定高效的流量提升解决方案,助力品牌曝光
稳定高效的流量提升解决方案,助力品牌曝光


最新版Sora2模型免费使用,一键生成无水印视频
最新版Sora2模型免费使用,一键生成无水印视频


实时语音翻译/同声传译工具
Transly是一个多场景的AI大语言模型驱动的同声传译、专业翻译助手,它拥有超精准的音频识别翻译能力,几乎零延迟的使用体验和支持多国语言可以让你带它走遍全球,无论你是留学生、商务人士、韩剧美剧爱好者,还是出国游玩、多国会议、跨国追星等等,都可以满足你所有需要同传的场景需求,线上线下通用,扫除语言 障碍,让全世界的语言交流不再有国界。


选题、配图、成文,一站式创作,让内容运营更高效
讯飞绘文,一个AI集成平台,支持写作、选题、配图、排版和发布。高效生成适用于各类媒体的定制内容,加速品牌传播,提升内容营销效果。


AI辅助编程,代码自动修复
Trae是一种自适应的集成开发环境(IDE),通过自动化和多元协作改变开发流程。利用Trae,团队能够更快速、精确地编写和部署代码,从而提高编程效率和项目交付速度。Trae具备上下文感知和代码自动完成功能,是提升开发效率的理想工具。


最强AI数据分析助手
小浣熊家族Raccoon,您的AI智能助手,致力于通过先进的人工智能技术,为用户提供高效、便捷的智能服务。无论是日常咨询还是专业问题解答,小浣熊都能以快速、准确的响应满足您的需求,让您的生活更加智能便捷。


像人一样思考的AI智能体
imini 是一款超级AI智能体,能根据人类指令,自主思考、自主完成、并且交付结果的AI智能体。
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号