This commit is contained in:
张威33321
2026-09-08 20:36:17 +08:00
parent 58d65188a1
commit fb87be680d
19 changed files with 398 additions and 212 deletions

View File

@@ -1,22 +1,30 @@
services:
certbot:
build: .
container_name: certbot
restart: unless-stopped
image: common-server-certbot:latest
# 一次性任务容器,不常驻:
# docker compose run --rm certbot certonly ... # 申请
# docker compose run --rm certbot renew # 续签
# 注意:官方镜像 ENTRYPOINT 已经是 certbot命令里不要再写一遍 certbot。
volumes:
- certbot-webroot:/var/www/certbot
- certbot-certs:/etc/letsencrypt
- certbot-logs:/var/log/letsencrypt
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- trim-default
volumes:
# 固定物理卷名,供 nginx/docker-compose.yml 以 external 方式引用。
# compose 默认会给卷名加项目名前缀,两个 compose 项目目录不同,
# 不显式指定 name 会导致两侧指向不同的卷。
certbot-webroot:
name: certbot-webroot
driver: local
certbot-certs:
name: certbot-certs
driver: local
certbot-logs:
name: certbot-logs
driver: local
networks: