Docker Let's Encrypt and certbot


#1

Hi!

I am trying to setup SSL for my Home Assistant in Docker. Are the following two commands correct for setting up SSL and auto renewal?

sudo mkdir /etc/letsencrypt /var/lib/letsencrypt
sudo docker run -it --rm -p 80:80 --name certbot \
                -v "/etc/letsencrypt:/etc/letsencrypt" \
                -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
                quay.io/letsencrypt/letsencrypt:latest certonly \
                --standalone --standalone-supported-challenges http-01 \
                --email [email protected] -d sub.domain.com

sudo 0 0 * * * docker run -it --rm -p 80:80 --name certbot \
                -v "/etc/letsencrypt:/etc/letsencrypt" \
                -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
                quay.io/letsencrypt/letsencrypt:latest renew >> /var/log/certbot.log 2>&1

#2

To answer my own question. Yes above works, remember to setup the volume in the docker container of home assistant:

/etc/letsencrypt/live/domain/fullchain.pem
/etc/letsencrypt/live/domain/privkey.pem