Run container in daemon mode (see below for ENVIRONMENTS details):
docker run -d \
--restart always \
-p80:80 \
-p443:443 \
--name nginx-certbot \
-e [email protected] \
-e [email protected] \
-e HOST_SMTP=smtp.example.com \
-e CERTBOT_ENABLE_RENEW=1 \
-e CERTBOT_CA_HOST=https://acme-v02.harica.gr/acme/... \
-v $(pwd)/volumes/etc/letsencrypt:/etc/letsencrypt \
vlauciani/nginx-certbot
ONLY FIRST TIME you need to register ACME account into the nginx-certbot running container:
docker exec -it nginx-certbot certbot register --server https://acme-v02.harica.gr/acme/... --email <email> --eab-kid <eab-kid> --eab-hmac-key <eab-hmac-key>
Get the certificate, install it, and automatically restart Nginx (the server_name in the Nginx configuration must match the domain specified with --domain option):
docker exec -it nginx-certbot certbot --nginx --non-interactive --server https://acme-v02.harica.gr/acme/... -v --cert-name <cert_name> --domain <domain>
With environment variables you can set:
CERTBOT_ENABLE_RENEW=1 (default 0): execute every 12hCERTBOT_ENABLE_RENEW_SEND_EMAIL=1 (default 0): used to send en e-mail on each renewHOST_SMTP=smtp.example.com (default not set): It is used to set SMTP host to send an email at each renew; Works only on port 25.[email protected] (default not set): Set the sender[email protected] (default not set): Set the receiverCERTBOT_CA_HOST=https://acme-v02.harica.gr/acme/... (default not set): Set CA Remote serverdocker exec -it nginx-certbot certbot renew --server https://acme-v02.harica.gr/acme/... -v
docker exec -it nginx-certbot certbot revoke --server https://acme-v02.harica.gr/acme/... -v --cert-name <cert_name>
docker exec -it nginx-certbot certbot delete --server https://acme-v02.harica.gr/acme/... -v --cert-name <cert_name>
Instead of using the pre-built docker image, you can build the Docker image by yourself:
docker build -t vlauciani/nginx-certbot .
docker composeExample:
services:
nginx:
image: vlauciani/nginx-certbot:latest
restart: always
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf.d:/etc/nginx/conf.d
- ./letsencrypt:/etc/letsencrypt
ports:
- 443:443
environment:
- CERTBOT_ENABLE_RENEW=1
- CERTBOT_ENABLE_RENEW_SEND_EMAIL=1
- HOST_SMTP=ssmail.rm.ingv.it
- [email protected]
- [email protected]
- CERTBOT_CA_HOST=https://acme-v02.harica.gr/acme/...
Thanks to your contributions!
Here is a list of users who already contributed to this repository:
Content type
Image
Digest
sha256:cd7d74343…
Size
114.6 MB
Last updated
4 months ago
docker pull vlauciani/nginx-certbot