This gist is an example on how to automate the Letsencrypt DNS challenge using cloudflare and docker. The docker image used in this gist is the official certbot/dns-cloudflare image.
- Install Docker and Docker Compose
- Update the cfcredentials.ini file and type in your email and api key
# Cloudflare API credentials used by Certbot
dns_cloudflare_email = <email>
dns_cloudflare_api_key = <apiKey>
- Enter your email and domain in the docker-compose-new.yaml file on line 9
command: certonly --dns-cloudflare --dns-cloudflare-credentials /root/.ssh/cfini -d <domain> -m <email> -n -v --agree-tos
- Run docker compose and create a new certificate
docker-compose -f docker-compose-new.yaml up
- To kee the certificates current, plan a job to run
docker-compose -f docker-compose-renew.yaml up
##Result
After you have done the setup, you should have a volume with the name something link this: letsencrypt_certs You cann now attach this volume to an nginx container and use the certificates on your webserver
to be written