caddy-cloudflare

caddy-cloudflare

Docker app from runraid's Repository

Overview

Caddy reverse proxy with the Cloudflare DNS module, built automatically from official Caddy images. Uses ghcr.io/rroller/caddy-cloudflare:2 for normal Unraid image updates. Before starting, create /mnt/user/appdata/caddy-cloudflare/Caddyfile as a regular file and add your Caddy configuration. For Cloudflare DNS challenges, set the masked CLOUDFLARE_API_TOKEN field and reference {env.CLOUDFLARE_API_TOKEN} in the Caddyfile. Use a token restricted to the required DNS zone with Zone Read and DNS Edit permissions. Keep the /data and /config paths persistent. No custom Caddy executable mount is needed. There is no administration web UI; visit the hostnames configured in your Caddyfile. Bridge mode defaults to host ports 8080 and 8443 to avoid Unraid management ports. If using standard external ports, forward TCP 80 to the configured HTTP host port and TCP 443 to the configured HTTPS host port; HTTP/3 additionally uses UDP 443. Alternatively assign a dedicated container IP and use ports 80 and 443. Adjust ports for your network; port mappings do not open router firewall rules.

Minimal Caddy with Cloudflare DNS

A personal Caddy image built from the official Caddy images, with only caddy-dns/cloudflare added. No home configuration, certificates, passwords or DNS tokens are included. This repository is independently maintained and is not an official Caddy distribution.

Use on Unraid

Set the container's Repository to:

ghcr.io/rroller/caddy-cloudflare:2

Keep your existing /etc/caddy/Caddyfile, /data and /config mappings and your Cloudflare token environment variable. Remove any /usr/bin/caddy mapping: the executable comes from the image. Unraid can then check and pull updates normally. Publishing an image does not automatically restart or update your Unraid container; use Unraid's normal update controls or an updater you separately configure.

Images target linux/amd64, matching the intended Unraid server. The repository and container package must both be public for anonymous pulls. GitHub initially creates container packages as private: after the first publish, open the package's settings and change its visibility to public once.

Automatic builds

GitHub Actions checks daily at 10:23 UTC, on pushes to main, and on manual runs. It selects the latest stable Caddy 2 release and the latest stable tagged Cloudflare module, then pulls the official builder/runtime images. Their exact digests and this repository's commit form a fingerprint. If the published :2 image already has the same fingerprint, the run skips the build and publish. Base image fixes therefore trigger a rebuild even without a Caddy version change.

When inputs change the workflow:

  1. Pins both official base images by digest and the module by version for that build.
  2. Builds the image and checks the actual Caddy and module versions.
  3. Confirms exactly one nonstandard module and validates a wildcard DNS configuration with a dummy token and networking disabled.
  4. Publishes the tested image to GHCR using the repository's GITHUB_TOKEN.
  5. Creates a GitHub build provenance attestation and uploads build metadata.

Tags: :2, :latest, :2.MINOR, :2.MINOR.PATCH, plus a unique :build-RUN_ID-ATTEMPT tag for rollback. Version tags can move when a module or base image changes. Use the unique build tag or digest to pin an exact image. Failed builds or validation do not replace the published image. A publication or attestation failure marks the workflow failed; already-pushed tags may exist.

No Cloudflare credentials, access to the home network, or long-lived registry password is needed by CI. Actions are pinned to commits; Dependabot proposes updates. Pull requests build and validate without publishing. Automated updates still trust GitHub Actions, official Caddy images, Go's module infrastructure, and the upstream Caddy and Cloudflare module maintainers.

GitHub can delay scheduled runs and can disable schedules in inactive public repositories after 60 days. Check the Actions page if builds stop, and re-enable the workflow if GitHub disables it. This is not an unattended deployment system.

Manual build and verification

With Docker, Git and Python 3 installed:

python3 -m unittest discover -s tests -v
python3 scripts/build.py
# Tested local image: caddy-build-test:local

For the versions directly specified in the Dockerfile (without automatic resolution):

docker build --pull -t caddy-cloudflare:local .

Resolve a published digest and verify its GitHub attestation:

docker buildx imagetools inspect ghcr.io/rroller/caddy-cloudflare:2
gh attestation verify oci://ghcr.io/rroller/caddy-cloudflare:2 --repo rroller/caddy-cloudflare

Build details are in each successful workflow's build-info artifact. Preserve caddy, cloudflare, builder, runtime, and revision from that file to rebuild the same source inputs. Attestations identify the GitHub build; they are not an independent security audit.

Categories

Related apps

Explore more like this

Explore all

Details

Repository
ghcr.io/rroller/caddy-cloudflare:2
Last Updated2026-11-02
First Seen2026-11-02

Runtime arguments

Network
bridge
Shell
sh
Privileged
false
Extra Params
--log-opt max-size=10m --log-opt max-file=3

Template configuration

HTTP PortPorttcp

HTTP listener and redirects. Defaults to 8080 to avoid Unraid management ports.

Target
80
Default
8080
Value
8080
HTTPS PortPorttcp

HTTPS listener. Defaults to 8443 to avoid Unraid management ports.

Target
443
Default
8443
Value
8443
HTTP/3 PortPortudp

Optional HTTP/3 listener. Use the same host port as HTTPS.

Target
443
Default
8443
Value
8443
CaddyfilePathro

Create this regular file before starting. Contains your Caddy configuration. Mounted read-only; edit it on the host.

Target
/etc/caddy/Caddyfile
Default
/mnt/user/appdata/caddy-cloudflare/Caddyfile
Value
/mnt/user/appdata/caddy-cloudflare/Caddyfile
Certificate DataPathrw

Persistent certificates, private keys and ACME account data. Back up and keep private.

Target
/data
Default
/mnt/user/appdata/caddy-cloudflare/data
Value
/mnt/user/appdata/caddy-cloudflare/data
Caddy StatePathrw

Persistent Caddy configuration state.

Target
/config
Default
/mnt/user/appdata/caddy-cloudflare/config
Value
/mnt/user/appdata/caddy-cloudflare/config
Cloudflare API TokenVariable

Required when using Cloudflare DNS challenges. Use a scoped token with Zone Read and DNS Edit permissions for your domain. Refer to it as {env.CLOUDFLARE_API_TOKEN} in the Caddyfile.

Target
CLOUDFLARE_API_TOKEN