如何在独立容器中配置LetsEncrypt-Cerbot

问题描述 投票:1回答:1

[我正在尝试查找有关在docker-container中运行certbot的简单文档,但是我所能找到的只是带有certbot + webserver等的复杂指南。官方页面有点无用... https://hub.docker.com/r/certbot/certbot/。我已经将网络服务器与我的网站分开,我也想自己运行certbot。

任何人都可以给我一些指导,以我如何生成具有mysite.com的Web根的/opt/mysite/html证书。

因为我已经在443和80端口上提供了服务,所以我想考虑使用certbot所需的“主机网络”,但是我真的不明白为什么当我的网站已经通过443提供服务​​时,为什么它需要访问443。

[我发现了类似的东西来生成certbot容器,但是我不知道如何“使用它”或告诉它为我的网站生成证书。

例如:

WD=/opt/certbot
mkdir -p $WD/{mnt,setup,conf,www}
cd $WD/setup
cat << 'EOF' >docker-compose.yaml
version: '3.7'

services:
  certbot:
    image: certbot/certbot
    volumes:
      - type: bind
        source: /opt/certbot/conf
        target: /etc/letsencrypt
      - type: bind
        source: /opt/certbot/www
        target: /var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
EOF
chmod +x docker-compose.yaml

此链接的内容与我需要的内容很接近,(显然,我需要将其域作为参数!)

Letsencrypt + Docker + Nginx

 docker run -it --rm \
  -v certs:/etc/letsencrypt \
  -v certs-data:/data/letsencrypt \
  deliverous/certbot \
  certonly \
  --webroot --webroot-path=/data/letsencrypt \
  -d api.mydomain.com

我想让所有内容都保持“隔离”状态,因此我希望仅在自己的容器中运行certbot,并将nginx / webserver配置为使用certs seperatley,并且不让certbot自动配置nginx或在与Windows相同的堆栈中运行网络服务器。

docker lets-encrypt certbot
1个回答
0
投票

最近,我一直在学习有关docker的很多东西,最近我学会了如何查看Dockerfilecertbot dockerfile给了我更多提示。

© www.soinside.com 2019 - 2024. All rights reserved.