certbot-scripting Docker ImageThis Docker image is customized from the official certbot Docker to provide a scripting capability in order to automate renew Let's Encrypt TLS certificates.
bash, curl and bind-tools (i.edig for DNS query).I built this Docker image to support my use case: use certbot Manual mode to renew our TLS certificates.
See Pre and Post Validation Hooks for details.
This is an example of how I used this image:
Suppose I have created a Compose stack:
my-letsencrypt/
├── docker-compose.yaml
├── letsencrypt
└── scripts
├── post_acme_challenge.sh
├── pre_acme_challenge.sh
└── renew-letsencrypt.sh
version: 3.0
services:
certbot-renew:
image: genzerhawker/certbot-scripting:latest
# Override the default entrypoint `certbot`
entrypoint: bash
command: script/renew-letsencrypt.sh
volumes:
# This should be the directory containing
# your Let's Encrypt certs.
# Normally, they are located at /etc/letsencrypt.
- ./letsencrypt:/etc/letsencrypt
- ./logs:/var/log/letsencrypt
- .scripts:/opt/certbot/scripts
env_file:
# This dotenv file should contains Environment Variables
# for accessing your DNS provider API (if any).
- your_dns_provider_credentials.env
#!/usr/bin/env bash
# NOTE #
#
# renew-lestencrypt.sh
set -e
echo "Renew Let's Encrypt certificate using certbot"
echo -e "[debug] - Renew domain *.example.com"
echo -e "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"
certbot certonly -a manual \
--non-interactive \
--preferred-challenge=dns-01 \
--manual-public-ip-logging-ok \
--manual-auth-hook "$(pwd)/scripts/pre_acme_challenge.sh" \
--manual-cleanup-hook "$(pwd)/scripts/post_acme_challenge.sh" \
-d "*.example.com" \
--server "https://acme-v02.api.letsencrypt.org/directory"
The pre_acme_challenge.sh and post_acme_challenge.sh are the two Bash scripts which you should implement to call your Domain Provider (e.g GoDaddy) to add the _acme-challenge TXT record.
docker-compose run --rm certbot-renew
Content type
Image
Digest
Size
51.4 MB
Last updated
about 7 years ago
docker pull genzerhawker/certbot-scripting:0.1.0