- Compatible with Cloudflare via API Token as of June 30 2024.
- Attempts to renew certificates every 12 hours.
- Supports multiple domains.
- Certificates are placed in /certs, in format [domain].crt (full certificate chain) and [domain].key (private key).
- Compatible with the nginx-proxy image. Refer to nginx-proxy's SSL Support documentation for details on how to do this.
To get it up and running, first build the image
docker build -t docker-certbot-dns-cloudflare:latest .then run it with your variables and volumes.
docker run -d -e CLOUDFLARE_API_TOKEN=YOUR_CLOUDFLARE_API_TOKEN -e EMAIL=YOUR_EMAIL -e DOMAIN=DOMAINS_SEPARATED_BY_COMMAS -v letsencrypt:/etc/letsencrypt -v certs:/certs docker-certbot-dns-cloudflare:latestOr use a compose file as follows, also available in this repository as compose.yaml.
services:
certbot:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
environment:
- CLOUDFLARE_API_TOKEN=YOUR_CLOUDFLARE_API_TOKEN
- EMAIL=YOUR_EMAIL
- DOMAIN=DOMAINS_SEPARATED_BY_COMMAS
volumes:
- config:/etc/letsencrypt
- certs:/certs
volumes:
config:
certs:And then bring up the container
docker compose up -dYour certs will be available in the certs (or certbot_certs for compose) volume, unless you change it to a folder in your home folder such as
- ~/certs:/certs| Variables | Description |
|---|---|
| CLOUDFLARE_API_TOKEN | Your Cloudflare API token |
| Your email | |
| DOMAIN | Domains seperated by commas |
| Container Path | Description |
|---|---|
| /etc/letsencrypt/ | Required for certbot |
| /var/lib/letsencrypt/ | Optional |
| /var/log/letsencrypt/ | Optional for persistent logging |
| /certs/ | Certs will be placed here |