Get Let’s Encrypt SSL certificates manually for Apache HTTP Server in Docker

If you want to generate Let’s Encrypt SSL certificates for HTTPS communication for your Apache HTTP Server running as Docker container, just follow these steps.

Steps beginning with new only are only for generating new certificates, steps beginning with renew only are only necessary if you got certificates before and want to renew them.

  • Go to Docker services directory (e. g. cd /var/docker)
  • Stop all Docker services: docker-compose down
  • Go to certificate directory (e. g. cd /etc/ssl/domain.tld/)
  • Renew only: Remove or rename old files domain.crt, domain.key and intermediate.pem
  • Browse to gethttpsforfree.com
  • Follow given instructions. Hint: just follow them and execute commands you find under “how do I generate this?” in every step on host machine. You don’t have to execute them in Docker container
  • In the end you got new files domain.crt, domain.key and intermediate.pem which can be used by Apache HTTP Server
  • New only: Link certificate directory as volume in Apache HTTP Server Docker container (e. g. Docker run with --volume /etc/ssl/domain.tld/:/etc/apache2/certs/domain.tld/). Add SSL configuration to Apache HTTP Server configuration as described in step 5 on gethttpsforfree.com
  • Go to Docker services directory and start your services (e. g. cd /var/docker && docker-compose up -d)