我有一台具有以下功能的服务器docker-compose.yml
:
version: "3"
services:
frontend:
restart: unless-stopped
image: staticfloat/nginx-certbot
ports:
- 80:80/tcp
- 443:443/tcp
environment:
CERTBOT_EMAIL: [email protected]
volumes:
- ./conf.d:/etc/nginx/user.conf.d:ro
- letsencrypt:/etc/letsencrypt
studio:
image: bitnami/nginx:latest
restart: always
volumes:
- ./build:/app
- ./default.conf:/opt/bitnami/nginx/conf/server_blocks/default.conf:ro
- ./configs/config.prod.js:/app/lib/config.js
depends_on:
- frontend
volumes:
letsencrypt:
networks:
default:
external:
name: studio
此外,还有一个conf.d/prod.conf
用于 nginx 配置的文件。
我做到了docker exec -it frontend_frontend_1 /bin/bash
,我可以看到有哪些/etc/nginx/user.conf.d/prod.conf
是/etc/nginx/conf.d/prod.conf
相同的。我知道是/etc/nginx/user.conf.d/prod.conf
因为- ./conf.d:/etc/nginx/user.conf.d:ro
in才安装的docker-compose.yml
,但为什么会在那里呢/etc/nginx/conf.d/prod.conf
?
有人知道吗?
因为当您运行
staticfloat/nginx-certbot
图像时,它会运行脚本/scripts/entrypoint.sh
,该脚本运行以下代码(除其他外):在执行环境变量替换时将文件从
/etc/nginx/user.conf.d
into复制。/etc/nginx/conf.d