How to use Certbot with server in docker container?

7,102

Certbot needs to validate your domain. You can find more details in Certbot's User Guide.

You can do this

  • manually (by configuring your web server to serve at www.yourdomain.com/.well-known/acme-challenge/ the challenge)
  • automatically
    • by using existing servers (Apache, nginx)
    • the "built in" standalone mode.

Most likely, you will want to add another container, with the Let's Encrypt Certbot image. You will also need to map the /etc/letsencrypt volume (and share it with your Tomcat container). Maybe make sure the folder is stored somewhere secure. (You don't want to store your certificates in the container, as they will be deleted when the container is restarted.)

You probably also need a cron job running either the host, or in a third container, to trigger the renewal of the certificate. The standard renewal command only renews the certificate when it has ≤30 days of validity remaining.

Share:
7,102

Related videos on Youtube

Nevado
Author by

Nevado

Updated on September 18, 2022

Comments

  • Nevado
    Nevado over 1 year

    I have Tomcat 8 running in a docker container. Specifically, the image tomcat:8-jre8 . I am trying to install a certificate from Let's Encrypt in order to get all communications to the server to run over https. The issue I am having is that I am not able to use certbot, the tool for automatic installation of the certificates, to see the server as it is running within docker.

    I have thought of installing cerbot in the container and then run it, but I haven't been able.

    If using cerbot is not practical in this situation, any help on manual installation of this certificates would be greatly appreciated too.