I am trying to use certbot image for my deployment and this is the related part of 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}
It produced this output:
certbot | /var/www/certbot/html does not exist or is not a directory
certbot exited with code 1
docker-compose version:
1.27.4
The operating system my web server runs on is (include version):
ubuntu 18
I can login to a root shell on my machine : yes
I'm also sure that {vm_path}/nginx/certbot-web-root exists, and the path is also absolute.
2 Likes
griffin
2
Welcome to the Let's Encrypt Community 
The webroot is the folder (directory) where the content of your website exists.
For example: /var/www/html
If you create a file named test containing "OK" in your webroot, you should be able to go to http://www.domain.com/test and see "OK".
Please see @_az's response below for a more detailed analysis before trying anything.
2 Likes
_az
3
It's weird that you'd get that error, because the Docker runtime will actually create the volume's source directory if it doesn't already exist.
That makes me think it's maybe permission-related? But if Docker runs as root as it usually does, that shouldn't happen either. SELinux maybe?
You could try sanity-check yourself with something like (remembering to replace {vm_path}):
docker run --rm -it -v {vm_path}/nginx/certbot-web-root:/var/www/certbot/html --entrypoint /bin/sh certbot/certbot:v1.9.0 -c 'ls -lah /var/www/certbot/html'
3 Likes
mahshiv
4
This is the output @_az :
total 8K
drwxr-xr-x 2 1001 1001 4.0K Nov 4 07:24 .
drwxr-xr-x 3 root root 4.0K Nov 4 10:18 ..
2 Likes
I've found the problem. In the command section I should have seprated -w and the path with \n not space!
@_az @griffin Thanks for your help.
2 Likes
system
Closed
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.