Setup Dynamic DNS With ddclient And Porkbun

Since there are no clear setup instructions, I'm just leaving this here for anyone who wants to set up a dynamic DNS record on a domain kept at Porkbun using ddclient.

Step 1: get ddclient

For convenience, I run pretty much everything in Docker containers. There's a well-maintained Linuxserver docker image for ddclient. Here's a snippet of my compose.yml file:

version: "2.1"
services:
  ddclient:
    image: lscr.io/linuxserver/ddclient:latest
    container_name: ddclient
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Amsterdam
    volumes:
      - ./ddclient:/config
    restart: unless-stoppedCode language: Python (python)

Step 2: Get an API key

Now you need to create a Porkbun API key. Read more about that here. Make sure you also enable API access for the domain you plan to use for this. If you don't, you'll get an error about it.

Step 3: Create the config file

I added the configuration file through a volume mount. The file is located at ./ddclient/ddclient.conf (relative to the Docker compose file).

There's a large example configuration file on the ddclient GitHub page that pointed me in the right direction. However, I still got some errors, so I had to tweak the example a little through trial and error. Here's my final configuration that works:

# Update every 9000 seconds
daemon=9000
# Use the default web based IP detection
use=web

protocol=porkbun
apikey=<your key>
secretapikey=<your secret>
subdomain.yourdomain.exampleCode language: Python (python)

What's left is firing up the container, e.g. with:

docker compose up -dCode language: Python (python)