Issues With Apache & Docker

Hi,

I am having issues with trying to install a Let's encrypt certificate.

I am hoping someone can help me with the below error. I have tried searing the forums but with no luck to solving this issue.

I have seen on other posts that it could be because of docker?

My domain is: mpzcrm.tech

I ran this command: sudo certbot --apache

It produced this output: Saving debug log to /var/log/letsencrypt/letsencrypt.log
The apache plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError('Cannot find Apache executable apache2ctl')

My web server is (include version): Apache

The operating system my web server runs on is : Ubuntu 24.04.3 LTS

My hosting provider, if applicable, is: N/A

I can login to a root shell on my machine : yes

I'm using a control panel to manage my site : no

The version of my client is:

That only works if Certbot is installed in the same container as Apache.

From the error that looks like it is not the case. You should look at using --webroot option instead and be sure you share the needed volumes accordingly

3 Likes

Thank you very much for your help.

The output was as below.

Is tere any guidance on doing the set up by hand?

With the webroot plugin, you probably want to use the "certonly" command, eg:

certbot certonly --webroot

(Alternatively, add a --installer flag. See User Guide — Certbot 5.1.0.dev0 documentation
and "--help plugins" for more information.)
Ask for help or search for solutions at https://community.letsencrypt.org. See t he logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for mo re details.

Setting up docker containers can be complicated. You won't be able to use the --installer flag either unless Certbot runs in the same container as your Apache

Start by visiting this: Get Certbot — Certbot 5.1.0.dev0 documentation

4 Likes

You should be using mod_md instead of certbot. (Make sure your volumes are configured appropriately, don't lose your certificates and private keys)

3 Likes

For mod_md and Docker, make note of the MDStoreDir setting. This is the location that @peppe means when saying not to lose your certs and keys.

This is described in the related github docs for mod_md. The below link is the section on File Storage:

3 Likes

I personally would recommend Lego for dockerized environment instead of certbot...

Lego has official docker image.

So does certbot, that's not the issue. Automating the installation in another container is the problem. That always relied on some hacky workarounds unless someone actually went and implemented proper dockerd hooks for either acme client.

2 Likes