Dockerized certbot 找不到挂载目录
Dockerized certbot can not find mounted directory
我正在尝试在虚拟机上部署我的服务,我的 docker-compose.yaml:
中有这部分内容
certbot:
container_name: certbot
image: certbot/certbot:v1.9.0
logging:
driver: "json-file"
options:
max-size: 500m
volumes:
- {vm_path}/certbot/certbot-etc:/etc/letsencrypt
- {vm_path}/certbot/certbot-var:/var/lib/letsencrypt
- {vm_path}/nginx/certbot-web-root:/var/www/certbot/html
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
command:
- certonly
- --webroot
- -w /var/www/certbot/html
- --email={email}
- --agree-tos
- --no-eff-email
- --dry-run
- -d {domain}
但是当我 运行 docker-compose up
时,我从 certbot 得到这个错误:
certbot | /var/www/certbot/html does not exist or is not a directory
目录 {vm_path}/nginx/certbot-web-root:/var/www/certbot/html
也存在于我的虚拟机上并且是绝对的。
------更新:
我的虚拟机 OS 是 Ubuntu 18.04。
我检查了docker-compose config
,里面没有问题。
也是 run ls -l /var/www/certbot
:
的结果
certbot | total 4
certbot | drwxr-xr-x 2 1001 1001 4096 Nov 4 10:54 html
并且 /var/www/certbot/html/
存在并且是空的。
我找到了答案。问题是命令部分语法,应该是:
command:
- certonly
- --webroot
- -w
- /var/www/certbot/html
- --email={email}
- --agree-tos
- --no-eff-email
- --dry-run
- -d
- {domain}
我正在尝试在虚拟机上部署我的服务,我的 docker-compose.yaml:
中有这部分内容certbot:
container_name: certbot
image: certbot/certbot:v1.9.0
logging:
driver: "json-file"
options:
max-size: 500m
volumes:
- {vm_path}/certbot/certbot-etc:/etc/letsencrypt
- {vm_path}/certbot/certbot-var:/var/lib/letsencrypt
- {vm_path}/nginx/certbot-web-root:/var/www/certbot/html
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
command:
- certonly
- --webroot
- -w /var/www/certbot/html
- --email={email}
- --agree-tos
- --no-eff-email
- --dry-run
- -d {domain}
但是当我 运行 docker-compose up
时,我从 certbot 得到这个错误:
certbot | /var/www/certbot/html does not exist or is not a directory
目录 {vm_path}/nginx/certbot-web-root:/var/www/certbot/html
也存在于我的虚拟机上并且是绝对的。
------更新:
我的虚拟机 OS 是 Ubuntu 18.04。
我检查了docker-compose config
,里面没有问题。
也是 run ls -l /var/www/certbot
:
certbot | total 4
certbot | drwxr-xr-x 2 1001 1001 4096 Nov 4 10:54 html
并且 /var/www/certbot/html/
存在并且是空的。
我找到了答案。问题是命令部分语法,应该是:
command:
- certonly
- --webroot
- -w
- /var/www/certbot/html
- --email={email}
- --agree-tos
- --no-eff-email
- --dry-run
- -d
- {domain}