DDNS image versions (Docker Tags):
latest
: Latest stable release (default stable release)next
: Next beta versionedge
: Latest development build, unstable (master branch)docker pull newfuture/ddns:latest
docker pull newfuture/ddns:next
You can also specify a specific version, for example:
docker pull newfuture/ddns:v4.0.0
Images are published to the following registries:
docker.io/newfuture/ddns
ghcr.io/newfuture/ddns
Supports docker pull ghcr.io/newfuture/ddns
DDNS Docker image supports three configuration methods: command line, environment variables, and config file.
Notes (for docker run):
-v
to mount config files or directories, ensure the /ddns/
directory in the container contains valid config files (like config.json
), otherwise DDNS will not work properly.--network host
, ensure your Docker daemon is properly configured to support this mode.-d
parameter to run the container in the background. Make sure you understand basic Docker operations before using.-e DDNS_XXX=YYY
parameters to set environment variables, and the DDNS program in the container will automatically read these variables.You can refer to the CLI parameter documentation for a detailed parameter list.
In this case, docker run -v /local/config/:/ddns/ --name=ddns --network=host newfuture/ddns
is equivalent to the ddns
command line and will not execute scheduled tasks.
This method is suitable for one-time runs or debugging scenarios. Parameters are identical to DDNS command line parameters.
# View ddns command line parameters, equivalent to ddns -h
docker run --rm newfuture/ddns -h
# Add ddns --debug parameter to enable debug mode (or --log.level=debug)
docker run --rm --network=host newfuture/ddns --debug --dns=dnspod --id=12345 --token=mytokenkey --ipv4=www.example.com --ipv4=ipv4.example.com --index4 public
# Debug inside container
docker run -it newfuture/ddns sh
The working directory inside the Docker container is /ddns/
, and the default config file is mapped to /ddns/config.json
inside the container.
docker run -d -v /host/config/:/ddns/ newfuture/ddns
Where /host/config/
is your local directory containing config.json
.
For details on config.json
content, refer to JSON Configuration File Documentation.
Environment variables are similar to command line parameters, with a DDNS prefix, recommended in uppercase. Array types need to use JSON format or be wrapped in single quotes.
You can also use the --env-file
parameter to load environment variable files.
docker run -d \
-e DDNS_DNS=dnspod \
-e DDNS_ID=12345 \
-e DDNS_TOKEN=mytokenkey \
-e DDNS_IPV4='["example.com","www.example.com"]' \
-e DDNS_INDEX4='["public",0]' \
--network host \
--name ddns \
newfuture/ddns
To learn about all supported environment variables, please refer to Environment Variable Configuration Documentation.
Using --network host
allows the container to directly use the host’s network, so DDNS can correctly obtain the host’s IP address.
For Public or URL modes, host network is usually not required.
docker run -d \
-e DDNS_DNS=dnspod \
-e DDNS_ID=12345 \
-e DDNS_TOKEN=mytokenkey \
-e DDNS_IPV4=example.com \
--network host \
newfuture/ddns
If you don’t want to use host network mode, you can also use the default bridge mode, but note that the container will have its own IP. You need to use public
mode to get the public IP:
docker run -d \
-e DDNS_DNS=dnspod \
-e DDNS_ID=12345 \
-e DDNS_TOKEN=mytokenkey \
-e DDNS_IPV4=example.com \
-e DDNS_INDEX4=public \
newfuture/ddns
Environment variable method for configuring multiple domains:
docker run -d \
-e DDNS_DNS=dnspod \
-e DDNS_ID=12345 \
-e DDNS_TOKEN=mytokenkey \
-e DDNS_IPV4='["example.com", "www.example.com", "sub.example.com"]' \
--network host \
newfuture/ddns
Command line parameter method for configuring multiple domains:
docker run --rm --network host newfuture/ddns \
--dns dnspod \
--id 12345 \
--token mytokenkey \
--ipv4 ipv4.example.com \
--ipv4 www.example.com
To use IPv6 in Docker containers, you need to ensure the Docker daemon is configured with IPv6 support:
/etc/docker/daemon.json
:{
"ipv6": true,
"fixed-cidr-v6": "fd00::/80"
}
sudo systemctl restart docker
docker run -d \
--network host \
-e DDNS_DNS=dnspod \
-e DDNS_ID=12345 \
-e DDNS_TOKEN=mytokenkey \
-e DDNS_IPV6=example.com \
newfuture/ddns
Create a docker-compose.yml
file:
version: "3"
services:
ddns:
image: newfuture/ddns:latest
restart: always
network_mode: host
environment:
- DDNS_DNS=dnspod
- DDNS_ID=12345
- DDNS_TOKEN=mytokenkey
- DDNS_IPV4=example.com,www.example.com
- DDNS_INDEX4=['public','url:https://api.ipify.org']
- DDNS_LOG_LEVEL=WARNING
version: "3"
services:
ddns:
image: newfuture/ddns:latest
restart: always
network_mode: host
volumes:
- ./config:/ddns
Run Docker Compose:
docker-compose up -d
If you need to add other tools or customize the environment in the container, you can create your own Dockerfile based on the official image:
FROM newfuture/ddns:latest
# Install additional tools
RUN apk add --no-cache curl
# Add custom scripts
COPY custom-script.sh /bin/
RUN chmod +x /bin/custom-script.sh
# Override default entrypoint (optional)
# ENTRYPOINT ["/bin/custom-script.sh"]
Problem: DDNS cannot correctly obtain host IP
Solution:
--network host
network mode-e DDNS_INDEX4=public
to force using public API to get IPProblem: Container runs but doesn’t automatically update DNS
Solution:
docker logs ddns
docker ps -a
docker exec ddns /bin/ddns
Problem: Container exits immediately after startup
Solution:
-it
parameter to run interactively and see the issue docker run -it --rm newfuture/ddns
Problem: Container cannot connect to DNS provider API
Solution:
docker exec ddns ping api.dnspod.cn
-e DDNS_PROXY=http://proxy:port
docker run -d \
-e DDNS_DNS=cloudflare \
-e DDNS_ID=user@example.com \
-e DDNS_TOKEN=your_cloudflare_api_token \
-e DDNS_IPV4='["example.com"]' \
--name ddns-cloudflare \
newfuture/ddns
docker run -d \
-e DDNS_DNS=alidns \
-e DDNS_ID=your_access_key_id \
-e DDNS_TOKEN=your_access_key_secret \
-e DDNS_IPV4='["example.com"]' \
--name ddns-alidns \
newfuture/ddns
docker run -d \
-e DDNS_DNS=huaweidns \
-e DDNS_ID=your_access_key \
-e DDNS_TOKEN=your_secret_key \
-e DDNS_IPV4='["example.com"]' \
--name ddns-huawei \
newfuture/ddns
docker run -d \
-e DDNS_DNS=tencentcloud \
-e DDNS_ID=your_secret_id \
-e DDNS_TOKEN=your_secret_key \
-e DDNS_IPV4='["example.com"]' \
--name ddns-tencent \
newfuture/ddns
# GET method callback
docker run -d \
-e DDNS_DNS=callback \
-e DDNS_ID="https://api.example.com/ddns?domain=__DOMAIN__&ip=__IP__" \
-e DDNS_TOKEN="" \
-e DDNS_IPV4='["example.com"]' \
--name ddns-callback-get \
newfuture/ddns
# POST method callback
docker run -d \
-e DDNS_DNS=callback \
-e DDNS_ID="https://api.example.com/ddns" \
-e DDNS_TOKEN='{"api_key": "your_key", "domain": "__DOMAIN__", "ip": "__IP__"}' \
-e DDNS_IPV4='["example.com"]' \
--name ddns-callback-post \
newfuture/ddns
docker run -d \
-e DDNS_DNS=cloudflare \
-e DDNS_ENDPOINT=https://api.private-cloudflare.com \
-e DDNS_ID=user@example.com \
-e DDNS_TOKEN=your_token \
-e DDNS_IPV4='["example.com"]' \
--name ddns-custom-endpoint \
newfuture/ddns