定时脚本 2 个月执行一次:
certbot renew --post-hook "docker restart 容器 ID"
看了 ssl 证书有更新,但是容器没自动重启,以至于容器里调用的 ssl 证书文件还是旧的,https 网页打开提示证书过期,手动执行一下 docker restart 就可以访问 https 网页
--post-hook 参数这样用应该没错吧?
谷歌了一下,貌似这样比较保险:
certbot renew --pre-hook "docker stop container_id" --post-hook "docker start container_id"
certbot renew --post-hook "docker restart 容器 ID"
看了 ssl 证书有更新,但是容器没自动重启,以至于容器里调用的 ssl 证书文件还是旧的,https 网页打开提示证书过期,手动执行一下 docker restart 就可以访问 https 网页
--post-hook 参数这样用应该没错吧?
谷歌了一下,貌似这样比较保险:
certbot renew --pre-hook "docker stop container_id" --post-hook "docker start container_id"