"Re-using" an existing certificate

I'm running a server with Docker container and installed the certificate inside the container.
Sometimes I have to upgrade the server which means deleting the current container and running a new one with the new version. I've linked the "/etc/letsencrypt" folder with the host folder and when starting the new server, when I enter "certbot certificates" it shows me the certificate that I've created on the previous server but now I want to use this certificate on a new one. How can I do it without deleting and generating a new SSL?

What happens if you run certbot install inside the container?

I mean, is there certbot inside the container?

You can install the same certificate in however many containers you want, even at the same time.


Simply migrate the /etc/letsencrypt/ directory over. While doing so, make sure you're keeping the symbolic links intact.

1 Like

That is an option...
But they would have to remember to migrate it back before upgrading [replacing the docker container with the latest directory info].

If they just link to that directory, then they can forget to migrate and still be OK.

I think I would prefer just using the @9peppe method:

[once for each cert in use]


The certbot install command is only used with the apache and nginx plugins and often those webservers are running in different Docker containers so that won't work, as the installer plugins won't work.

I'm also not sure if that's what OP is asking.


That's where my doubt comes from.

And yet, the old principle "one service per container" is "not always" adhered to. (Mostly when people use containers to distribute software)


Difficult to say what is going on here...
Is the glass half empty OR half full?
OR maybe both!

Yes, we are agreed, certbot install will only work if certbot can reach the web server config files.


If you read between the lines:

You can almost see that they do have certbot running within the same Docker container.
OR do they?


Yes, the certbot is inside the container and yes, certbot install works for me. I was looking for this command with certbot --help but didn't find it. Knowing that I can save the SSL and use on another container.
Thank you!


You can find it ALL here:
User Guide — Certbot documentation (eff-certbot.readthedocs.io)


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.