A Docker image to automatically update your DuckDNS records using either:
- Internal (LAN) IPv4 and/or IPv6 addresses
- External (public) IPv4 and/or IPv6 addresses
This project is based on the excellent work from LinuxServer.io, but has been significantly modified to support updating private network addresses, making it ideal for homelab environments.
- Update internal IPv4 addresses (e.g.
192.168.x.x,10.x.x.x) - Update internal IPv6 addresses
- Update external IPv4 and IPv6 addresses
- Support for updating:
- IPv4 only
- IPv6 only
- Both IPv4 and IPv6
- Optional logging to
/config/duck.log - Multi-subdomain support
- Compatible with Docker Compose, Dokploy, and Docker Swarm
- Based on Alpine Linux with s6-overlay
Normally, DuckDNS containers update your public IP address. In many homelab environments, however, DNS is used only inside the local network and should point to a server's private IP address.
Examples:
192.168.1.10192.168.100.12010.0.0.50
This image adds support for:
USE_INTERNAL_IP=true
When enabled, the container detects the host's LAN address and updates DuckDNS using that value.
- amd64 (x86_64)
- arm64 (aarch64)
- Create an account at https://www.duckdns.org/
- Create one or more subdomains.
- Obtain your DuckDNS token.
- Deploy this container with the required environment variables.
Unless marked as optional, all variables are required.
services:
duckdns:
image: ghcr.io/luiscbrenes/docker-duckdns:latest
container_name: duckdns
network_mode: host
environment:
- PUID=1000 # optional
- PGID=1000 # optional
- TZ=America/Costa_Rica # optional
- SUBDOMAINS=mydomain
- TOKEN=your-duckdns-token
- UPDATE_IP=ipv4 # optional: ipv4, ipv6, both
- USE_INTERNAL_IP=true # optional
- LOG_FILE=true # optional
volumes:
- ./config:/config
restart: unless-stoppedUse the following image:
ghcr.io/luiscbrenes/docker-duckdns:latest
Set the environment variables in the Dokploy interface and enable network_mode: host.
docker run -d \
--name duckdns \
--net=host \
-e SUBDOMAINS=mydomain \
-e TOKEN=your-duckdns-token \
-e UPDATE_IP=ipv4 \
-e USE_INTERNAL_IP=true \
-e LOG_FILE=true \
-v $(pwd)/config:/config \
--restart unless-stopped \
ghcr.io/luiscbrenes/docker-duckdns:latest| Variable | Required | Description |
|---|---|---|
SUBDOMAINS |
Yes | One or more DuckDNS subdomains separated by commas |
TOKEN |
Yes | Your DuckDNS token |
UPDATE_IP |
No | ipv4, ipv6, or both |
USE_INTERNAL_IP |
No | Set to true to use LAN IP addresses |
LOG_FILE |
No | Set to true to log to /config/duck.log |
PUID |
No | User ID for mounted volumes |
PGID |
No | Group ID for mounted volumes |
TZ |
No | Timezone |
USE_INTERNAL_IP |
UPDATE_IP |
Result |
|---|---|---|
false or unset |
unset | DuckDNS auto-detects public IPv4 |
false or unset |
ipv4 |
Detect public IPv4 via Cloudflare |
false or unset |
ipv6 |
Detect public IPv6 via Cloudflare |
false or unset |
both |
Detect both public IPv4 and IPv6 |
true |
ipv4 |
Detect internal IPv4 |
true |
ipv6 |
Detect internal IPv6 |
true |
both |
Detect both internal IPv4 and IPv6 |
Note:
USE_INTERNAL_IP=trueis intended to be used together withUPDATE_IP. IfUPDATE_IPis omitted, DuckDNS will auto-detect the public IPv4 address.
When LOG_FILE=true, logs are written to:
/config/duck.log
The log file includes:
- Detected IP addresses
- Successful updates
- No-change notifications
- Error responses from DuckDNS
environment:
- SUBDOMAINS=homelab
- TOKEN=your-token
- UPDATE_IP=ipv4
- USE_INTERNAL_IP=trueenvironment:
- SUBDOMAINS=homelab
- TOKEN=your-token
- UPDATE_IP=both
- USE_INTERNAL_IP=trueenvironment:
- SUBDOMAINS=homelab
- TOKEN=your-tokenHost networking is recommended, especially when:
- Detecting IPv6 addresses
- Running in homelab environments
- Using internal IP detection
network_mode: hostgit clone https://github.com/luiscbrenes/docker-duckdns.git
cd docker-duckdns
docker build \
--no-cache \
--pull \
-t ghcr.io/luiscbrenes/docker-duckdns:latest .docker push ghcr.io/luiscbrenes/docker-duckdns:latestdocker compose pull
docker compose up -ddocker logs -f duckdnsdocker exec -it duckdns /bin/bashdocker inspect -f '{{ index .Config.Labels "build_version" }}' duckdnsThis image is particularly useful for:
- Homelabs
- Internal DNS resolution
- Reverse proxies such as Traefik and Nginx Proxy Manager
- Local-only services
- Split-horizon DNS environments
This project is based on the original https://github.com/linuxserver/docker-duckdns image created by LinuxServer.io.
The code has been significantly modified to support internal IP detection and custom update workflows.
This project inherits the license of the original project unless otherwise specified.