This project provides dynamic DNS updates for Docker containers. It listens for Docker container start events and automatically updates DNS records for containers with the appropriate labels.
- Listens for Docker container start events in real time (no polling)
- Updates DNS records using RFC2136 for containers with
ddns.enablelabel and Traefik host rules - Configurable via Docker secrets or environment variables
-
Build the Docker image:
docker build -t docker-ddns . -
Run the container:
docker run --rm \ -v /var/run/docker.sock:/var/run/docker.sock \ -e DNS_HOST=your_dns_server \ -e TSIG_NAME=your_tsig_name \ -e TSIG_KEY=your_tsig_key \ -e VALID_DOMAINS=example.com \ -e HOST_IP=1.2.3.4 \ docker-ddns
-
Label your containers:
- Add
ddns.enable=trueand a Traefik host rule label to any container you want to manage DNS for.
- Add
- The service listens to Docker events and triggers a DNS update when a new container is started.
- Only containers with the
ddns.enable=truelabel and a valid Traefik host rule are processed.
DNS_HOST: DNS server addressDNS_PORT: DNS server port (default: 53)TSIG_NAME: TSIG key nameTSIG_KEY: TSIG key valueTSIG_ALGO: TSIG algorithm (default: HMAC-SHA256)VALID_DOMAINS: Comma-separated list of valid domainsHOST_IP: IP address to assign in DNS recordsDOCKER_URL: (optional) Docker socket URL
- Docker socket must be mounted (
-v /var/run/docker.sock:/var/run/docker.sock) - Python 3.13+ (if running outside Docker)
MIT