Let's Encrypt Wildcard With Docker

Hello guys. I was following this tutorial How To Secure a Containerized Node.js Application with Nginx, Let’s Encrypt, and Docker Compose, which is very complete and easy to go through. But, what if I want to create a wildcard certificate with Let’s Encrypt to deploy along with all my API? How difficult would it be to adapt the instructions from this article? By the way, this wildcard certificate would be valid to a web server as well, right?

Best regards


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello @bobbyiliev

Thanks for your reply. Another question: can I create an isolated container only for certbot certificate information and associate it with a docker-compose when needed?

Hi there @renatospaka,

I believe that in order to obtain a wildcard SSL certificate you would have to adjust the following line in your docker-compose file:

    command: certonly --webroot --webroot-path=/var/www/html --email --agree-tos --no-eff-email --force-renewal -d -d

And set it to:

    command: certonly --webroot --webroot-path=/var/www/html --email --agree-tos --no-eff-email --force-renewal -d -d *

This would generate a wildcard SSL certificate which you could use for all of your subdomains.

Hope that this helps! Regards, Bobbt