Report this

What is the reason for this report?

Let's Encrypt Wildcard With Docker

Posted on June 3, 2020

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



This textbox defaults to using Markdown to format your 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.

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 sammy@example.com --agree-tos --no-eff-email --force-renewal -d example.com -d www.example.com

And set it to:

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

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

Hope that this helps! Regards, Bobbt

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?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.