我面临官方 Certbot Docker 镜像默认不包含 NGINX 插件的问题。不幸的是,似乎没有提供有关如何将此插件添加到现有 Certbot 映像的文档。 Alpine 存储库还缺少 python3-certbot-nginx 软件包,因此我无法使用 Alpine 创建自己的自定义映像。
在 docker 容器内运行以下命令:
certbot --nginx -d example.com
我收到以下错误
The requested nginx plugin does not appear to be installed
我研究了 Alpine 软件包的可用性,并尝试在 Certbot Dockerfile 中使用 apk 添加 NGINX 插件,但遇到错误,表明在 Alpine 存储库中找不到该软件包。
寻求指导或解决方法:
感谢解决此问题的任何帮助或建议。谢谢你。
由于 alpine 本身没有 python3-certbot-nginx 软件包,我们可以使用 pip 来安装相同的软件包。 要将 nginx 插件添加到官方 certbot 镜像中,我们可以这样做
FROM certbot/certbot:latest
RUN pip3 install certbot-nginx
虽然它确实将 nginx 插件添加到在容器内运行的 certbot 中,但如果我们将 certbot 和 nginx 作为单独的服务运行,我们就无法按预期将其与 certbot 一起使用。 Certbot 将需要访问 nginx 二进制文件以及所有 nginx conf 文件的路径。可以通过使用绑定安装来做到这一点(由于时间限制尚未尝试)。但我改用 webroot 来满足我的特定用例。