Renewing Lets Encrypt Certificate using Docker

If you have Docker installed on your server, you can use this trick to get Lets Encrypt certificates. It starts a temporary server to do the validation. And using the mount it will write back the certificates to your local filesystem.

Run this code in your console, and follow the instructions


sudo docker run -it --rm --name certbot \
            -v "/etc/letsencrypt:/etc/letsencrypt" \
            -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
      -p 80:80 -p 443:443 \
            certbot/certbot certonly