Caddy alpine with cloudflare-dns add-on
587
Caddy with the Cloudflare DNS module included. Use Cloudflare DNS-01 challenges to get and renew HTTPS certificates, including wildcard certificates, without building a custom image.
Based on the official Caddy Alpine image, with caddy-dns/cloudflare added through xcaddy.
Maintained by Gilad Peleg.
docker pull pgilad/caddy-cloudflare:2.11.9-alpine
Supported platforms: linux/amd64 and linux/arm64.
Tags use <caddy-version>-alpine. Published tags cannot be overwritten. Use an explicit version tag in your configuration.
See all available tags.
Use a domain with DNS hosted by Cloudflare. Replace example.com below with your domain, and point its A/AAAA records to your server.
Create a token with these permissions for the DNS zone that Caddy will manage:
Save it in a .env file next to compose.yaml:
CLOUDFLARE_API_TOKEN=replace-with-your-token
Keep this file out of version control.
conf/Caddyfileexample.com {
tls {
dns cloudflare {env.CLOUDFLARE_API_TOKEN}
}
respond "Caddy with Cloudflare DNS is running."
}
Replace respond with your site configuration or a reverse_proxy directive.
compose.yamlservices:
caddy:
image: pgilad/caddy-cloudflare:2.11.9-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "443:443/udp"
environment:
CLOUDFLARE_API_TOKEN: ${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN in .env}
volumes:
- ./conf:/etc/caddy:ro
- caddy_data:/data
- caddy_config:/config
volumes:
caddy_data:
caddy_config:
docker compose up -d
Keep the /data volume across container updates. It stores certificates, private keys, and other required data.
This repository uses the MIT license. Included software retains its own licenses.
Content type
Image
Digest
sha256:776d9005d…
Size
41 MB
Last updated
2 days ago
docker pull pgilad/caddy-cloudflare:2.11.9-alpine