Create a Docker Apache image with LetsEncrypt -
i have trouble docker , letsencrypt.
as far can understand, certbot (the bot install letsencrypt on apache or http server) checks if user owns domain associated certificate.
so in dockerfile, add following line :
run certbot --apache -n --agree-tos --email me@mail.com -d domain.tld the trouble during domain check, certbot installs certificate on http server, , checks server exposes installed certificate resolving domain.
what mean, domain check can work if cerbot command run on online web server.
but apache server not launched during docker image build.
do have idea arround problem ? can execute command after container launched, install certificate in dockerfile.
thank you
you should remove certbot apache image , run letsencrypt in separate container blacklabelops/letsencrypt.
- create dummy certificate certbots testmode during image build
- start apache on target system
- start blacklabelops/letsencrypt in webroot mode, no port used , challenges exchanged apache webcontext.
- create real certificate , keep container running monthly updates
the letsencrypt container must started in webroot mode:
$ docker run -d \ -v letsencrypt_certificates:/etc/letsencrypt \ -v letsencrypt_challenges:/var/www/letsencrypt \ -e "letsencrypt_webroot_mode=true" \ -e "letsencrypt_email=dummy@example.com" \ -e "letsencrypt_domain1=example.com" \ --name letsencrypt \ blacklabelops/letsencrypt note: here certs written docker volume
letsencrypt_certificateswebchallenges writtenletsencrypt_challenges
your apache must mount volume , publish challenges under webroot: /.well-known/acme-challenge/.
example, files under letsencrypt_challenges must reachable under:
http(s)://yourdomain.com/.well-known/acme-challenge/
Comments
Post a Comment