Docker 容器内 Certbot 安装在失败

Docker 容器内 Certbot 安装在失败

我正在尝试使用 apt-mirror、Cerbot for Letsencrypt 和 Nginx 创建一个 Docker 容器。

有一个用于 nginx/certbot 的图像,但它基于 Alpine Linux。对于 apt-mirror,我需要基于 debian 的发行版。

我已经尝试过官方EFF 教程但出现以下错误:

invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of force-reload.
Failed to open connection to "system" message bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
Setting up packagekit-tools (1.1.5-2+deb9u1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for ca-certificates (20161130+nmu1+deb9u1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Processing triggers for dbus (1.10.26-0+deb9u1) ...
Processing triggers for systemd (232-25+deb9u11) ...
Error: 'universe' invalid

我的docker文件:

FROM nginx:stable

RUN apt-get update &&\
    apt-get install -y cron software-properties-common &&\
    add-apt-repository universe &&\
    add-apt-repository ppa:certbot/certbot &&\
    apt-get update &&\
    apt-get install certbot python-certbot-nginx

RUN certbot --nginx &&\
    certbot renew --dry-run

CMD [ "sh", "-c", "nginx" ]

相关内容