Hello,
I’m using Certbot with Docker and have some problems with pre and post hooks. For example I want restart nginx container.
I’m using command below:
sudo docker run -it --rm --name certbot \
-v "/etc/letsencrypt:/etc/letsencrypt" \
-v "/var/lib/letsencrypt:/var/lib/letsencrypt" \
-v "/var/log/letsencrypt:/var/log/letsencrypt" \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-v $(which docker):/usr/bin/docker \
-e AWS_ACCESS_KEY_ID="****" \
-e AWS_SECRET_ACCESS_KEY="****" \
certbot/dns-route53 certonly --dns-route53 --dry-run -d example.net -d www.example.net --pre-hook "/usr/bin/docker restart nginx"
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Found credentials in environment variables.
Plugins selected: Authenticator dns-route53, Installer None
Running pre-hook command: /usr/bin/docker restart nginx
pre-hook command "/usr/bin/docker restart nginx" returned error code 127
Error output from pre-hook command docker:
/bin/sh: /usr/bin/docker: not found
Obtaining a new certificate
Performing the following challenges:
dns-01 challenge for example.net
dns-01 challenge for www.example.net
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
- The dry run was successful.
ubuntu@ip-172-31-34-210:~$
Does anybody know if this achivable at all? I mean using hooks if you use Certbot with Docker.