Please see the official Caddy Docker Image for deployment instructions.
Builds are available at the following Docker repositories:
- Docker Hub: docker.io/slothcroissant/caddy-cloudflaredns
- GitHub Container Registry: ghcr.io/slothcroissant/caddy-cloudflaredns
- Quay Container Registry: quay.io/slothcroissant/caddy-cloudflaredns
Few things to note:
-
You should add CLOUDFLARE_EMAIL and CLOUDFLARE_API_TOKEN as environment variables to your
docker run
command. Example:docker run -it --name caddy \ -p 80:80 \ -p 443:443 \ -v caddy_data:/data \ -v caddy_config:/config \ -v $PWD/Caddyfile:/etc/caddy/Caddyfile \ -e [email protected] \ -e CLOUDFLARE_API_TOKEN=12345 \ -e ACME_AGREE=true \ slothcroissant/caddy-cloudflaredns:latest
You can obtain your Cloudflare API token via the Cloudflare Portal. To create a API token with minimal scope, the following steps are needed:
-
Log into your dashboard, go to account settings, create API token
-
grant the following permissions:
- Zone / Zone / Read
- Zone / DNS / Edit
-
-
You should add the following to your Caddyfile as the tls directive.
tls {$CLOUDFLARE_EMAIL} { dns cloudflare {$CLOUDFLARE_API_TOKEN} }
-
This image now supports tagging! See available tags here. To select a specific version of
caddy
, set your Docker image tag to the caddy version you'd like to use.Example:
slothcroissant/caddy-cloudflaredns:2.4.3