Getting Certificate to Work with NGINX Container

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g., so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is:

I ran this command: sudo ./init-letsencrypt

It produced this output:

  • The following errors were reported by the server:

    Type: connection
    Detail: Fetching
    Connection refused

    To fix these errors, please make sure that your domain name was
    entered correctly and the DNS A/AAAA record(s) for that domain
    contain(s) the right IP address. Additionally, please check that
    your computer has a publicly routable IP address and that no
    firewalls are preventing the server from communicating with the
    client. If you’re using the webroot plugin, you should also verify
    that you are serving files from the webroot path you provided.

  • Your account credentials have been saved in your Certbot
    configuration directory at /etc/letsencrypt. You should make a
    secure backup of this folder now. This configuration directory will
    also contain certificates and private keys obtained by Certbot so
    making regular backups of this folder is ideal.

  • We were unable to subscribe you the EFF mailing list because your
    e-mail address appears to be invalid. You can try again later by

Reloading nginx …

ERROR: No container found for nginx_1

My web server is (include version):

The operating system my web server runs on is (include version): Debian 9

My hosting provider, if applicable, is: Digital Ocean
Can login to a root shell on my machine (yes or no, or I don’t know): Yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot): Certbot Docker image

NOTES: I’ve run the script prior to fixing my docker-compose.yml with commands to auto-renew using domain … I changed the app everywhere to . I suspect you (Letsencrypt) still have my certificate request for another machine (earlier) that was an Apache web server for static hosting. I deleted my DNS records for and created new for So I had to revise everything from to and do the chicken-egg thing with the script to get the cert going. I do know that iptables get’s modified automatically with Docker so that could very well be the “connection” issue back to

The issue is resolved. Two things fixed this. Since my nginx.conf contained a 443 server, I had to comment that out. And, also I added restart: to my nginx service in my docker compose. I deleted my local certbot folder (all contents) and then reran my script with all my 443 config commented out. This time just the nginx started (executed from the docker-compose.yml) from the script.

Sorry for the post.

David L. Whitehurst (

Thanks for coming back and letting us know you found a solution! Best of luck out there @dlwhitehurst.

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