valentin2105
5/17/2016 - 7:17 AM

Template for renewing a letsencrypt certificate in a docker nginx proxy via letsencrypt's docker image

Template for renewing a letsencrypt certificate in a docker nginx proxy via letsencrypt's docker image

#!/bin/sh

mkdir -p {{ proxy_dir }}/www/{{ domain }}

docker pull quay.io/letsencrypt/letsencrypt

docker run -it --rm --name letsencrypt \
  -v "/etc/letsencrypt:/etc/letsencrypt" \
  -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
  --volumes-from {{ proxy_docker_container }} \
  quay.io/letsencrypt/letsencrypt \
  certonly \
  --webroot \
  --webroot-path /var/www/{{ domain }} \
  --agree-tos \
  --renew-by-default \
  -d {{ domain }} \
  -m {{ email }}

docker kill --signal=HUP {{ proxy_docker_container }}