Skip to content

cloudflare DDNS updater swarm template

Description

  • This template runs my cloudflare dynamic DNS updater.
  • It adjusts the default container cron job from 5 minutes to 1 minute because i have failover WAN ports.
  • The image is archived upstream. I still run it, pinned by digest.

State Considerations for SWARM

none, this container is configured by env vars, except the API key, which is a swarm secret. An entrypoint wrapper reads it at startup, see secrets.

Network Considerations

none, this needs no special port mappings or other considerations

Placement Considerations

None, by default this template will result in a single replica

compose.yml, 21 lines, 1 note

each in the code opens a note on that line. download compose.yml

version: '3'
services:
  cloudflare-ddns:
    image: oznu/cloudflare-ddns:latest@sha256:19bd73d8aea9641dc329ec18ae693b2b9c33ff7cdc007f368266ce584446f995
    restart: always
    entrypoint:  # (1)!
      - /bin/sh
      - -c
      - set -e; API_KEY="$$(cat /run/secrets/cloudflare_dns_api_key_v2)"; export API_KEY; exec /init
    environment:
      - TZ=America/Los_Angeles
      - ZONE=mydomain.com
      - SUBDOMAIN=external
      - PROXIED=false
      - CRON=* * * * *
    secrets:
      - cloudflare_dns_api_key_v2

secrets:
  cloudflare_dns_api_key_v2:
    external: true
  1. a shell reads the swarm secret into API_KEY, then execs /init, the image's s6 entrypoint. a missing secret makes the container exit before /init runs.

This page started as a gist: the original, with its comments