Caddy 2 with Cloudflare DNS, DuckDNS, and security plugins for auto HTTPS
10K+
Caddy web server with Cloudflare DNS plugin — automatic HTTPS with wildcard certs, even behind NAT.
The official Caddy image doesn't include the Cloudflare DNS plugin. This image adds:
*.yourdomain.com with one configdocker run -d \
--name caddy \
-p 80:80 -p 443:443 \
-e CLOUDFLARE_API_TOKEN=your-token-here \
-v ./Caddyfile:/etc/caddy/Caddyfile \
-v caddy-data:/data \
-v caddy-config:/config \
zachbg/caddy-cloudflare
services:
caddy:
image: zachbg/caddy-cloudflare
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp" # HTTP/3
environment:
- CLOUDFLARE_API_TOKEN=${CLOUDFLARE_API_TOKEN}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy-data:/data
- caddy-config:/config
volumes:
caddy-data:
caddy-config:
CLOUDFLARE_API_TOKEN environment variable*.home.example.com {
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
@jellyfin host jellyfin.home.example.com
handle @jellyfin {
reverse_proxy jellyfin:8096
}
@nextcloud host cloud.home.example.com
handle @nextcloud {
reverse_proxy nextcloud:80
}
}
app.example.com {
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
reverse_proxy app:3000
}
| Plugin | Purpose |
|---|---|
caddy-dns/cloudflare | Cloudflare DNS-01 ACME challenge |
caddy-dns/duckdns | DuckDNS DNS-01 ACME challenge |
caddy-security | Authentication portal (SSO, OAuth, etc.) |
transform-encoder | Structured/JSON access logs |
docker buildx build --platform linux/amd64,linux/arm64 -t zachbg/caddy-cloudflare --push .
MIT
Content type
Image
Digest
sha256:6307ee4cd…
Size
45.3 MB
Last updated
6 months ago
docker pull zachbg/caddy-cloudflare