wmnnd / nginx-certbot

Boilerplate configuration for nginx and certbot with docker-compose
MIT License
3.16k stars 1.17k forks source link

Error response from daemon, wait until the container is running #69

Open kosyachniy opened 4 years ago

kosyachniy commented 4 years ago

I follow the instruction. I changed domains and mail in init-letsencrypt.sh and app.conf. When I run ./init-letsencrypt.sh, I get error:

### Creating dummy certificate for kosyachniy.com ...
Generating a RSA private key
.....+++++
.............................+++++
writing new private key to '/etc/letsencrypt/live/kosyachniy.com/privkey.pem'
-----

### Starting nginx ...
Recreating nginx-certbot_nginx_1 ... done

### Deleting dummy certificate for kosyachniy.com ...

### Requesting Let's Encrypt certificate for kosyachniy.com ...
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for kosyachniy.com
Using the webroot path /var/www/certbot for all unmatched domains.
Waiting for verification...
Challenge failed for domain kosyachniy.com
http-01 challenge for kosyachniy.com
Cleaning up challenges
Some challenges have failed.

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: kosyachniy.com
   Type:   connection
   Detail: Fetching
   http://kosyachniy.com/.well-known/acme-challenge/BMxxYdv7natNOi8C6C29sGc9Y7SUY9OFmlhaGxA_R2o:
   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.

### Reloading nginx ...
Error response from daemon: Container d91885e4419fed65d3539f8ec9f0ed880b3a4f2eb82f1468e3f825349dde727d is restarting, wait until the container is running

How can I fix it?

BenoitRanque commented 4 years ago

Happened to me, I had not changed the domain properly, so the path to the certificated was invalid, preventing nginx from starting

sheodox commented 4 years ago

I'm not sure if this is your issue, but I was running into the same issue. In init-letsencrypt.sh I removed the -d from the docker-compose command that starts nginx after creating the dummy certificate so I could see any logs and sure enough it was complaining about the dummy certificate and it said something like "ee key too small" and nginx wouldn't start.

I fixed it by changing rsa:1024 to rsa:2048 in the openssl command (then re-adding the -d I had removed) and then everything worked.