cdd
This is a tool to automate subdomain (record) creation at Cloudflare DNS, based on Docker labels.
cdd means Cloudflare DNS for Docker.
Installation
You just have to run the provided Docker image, and give it access to the Docker socket.
You can use the suggested compose.yaml here:
services:
cdd:
container_name: cdd
image: ramiuslr/cdd:latest # or build: . for dev setup
environment:
CLOUDFLARE_TOKEN: <your_token>
CLOUDFLARE_ZONE: example.com
CNAME: srv.example.com # a cname pointing to your server
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
Or you can just download it from the releases, and execute it as a standalone binary. Feel free to create a custom rc or system script to declare it as a service.
Usage
Look at the example below:
services:
nginx:
container_name: nginx
restart: unless-stopped
image: nginx
labels:
cloudflare.enable: true
cloudflare.fqdn: "subdomain.example.com"
cloudflare.proxied: true
How does it work ?
At first start cdd scans every running container know by the docker daemon.
For every properly labeled container, it checks if the A and AAAA records exist
and are properly pointing to the CNAME defined in its environment.
Then it monitors every start event, each triggering a check, and record creation if necessary.
It also monitors container destruction, which triggers a timer (duration set via env variable) before it deletes the associated record. This timer mechanism is implemented to avoid deletion / recreation when a container restarts.
Project status
This is a pre-alpha software. Not all the functionnalities are implemented yet, you should not use this in production.
Contributing
Contributions are very welcome, feel free to open issues or pull requests.
License
This project is released under the MIT license.
MIT License Copyright (c) 2024-2025 ramiuslr