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.

  1. create dummy certificate certbots testmode during image build
  2. start apache on target system
  3. start blacklabelops/letsencrypt in webroot mode, no port used , challenges exchanged apache webcontext.
  4. 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_certificates webchallenges written letsencrypt_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

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -