Using CertBot with Docker and `/opt/` directory


My domain is: (not running the whole time as it is just for testing)

I ran this command:

docker run -it --rm \
        -v "$(pwd)"/data/etc/letsencrypt:/etc/letsencrypt \
        -v "$(pwd)"/data/var/lib/letsencrypt:/var/lib/letsencrypt \
        -v "$(pwd)"/data/acme:/data/acme \
        -v "$(pwd)"/data/var/log/letsencrypt:/var/log/letsencrypt \
        -v "$(pwd)"/secp384r1.csr:/data/secp384r1.csr \
        -v "$(pwd)"/data/ecc_cert:/opt/certbot \ #The line that causes the error
        certbot/certbot certonly \
        --csr /data/secp384r1.csr \
        --webroot \
        --register-unsafely-without-email \
        --agree-tos \
        --webroot-path=/data/acme \
        --staging \

It produced this output:

Traceback (most recent call last):
  File "/usr/local/bin/certbot", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/", line 3105, in <module>
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/", line 3089, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/", line 3118, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/", line 578, in _build_master
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/", line 895, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/local/lib/python2.7/site-packages/pkg_resources/", line 781, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'certbot' distribution was not found and is required by the application

My web server is (include version): latest version of official nginx on docker hub

The operating system my web server runs on is (include version): Ubuntu 18.04

My hosting provider, if applicable, is: N/A

I can login to a root shell on my machine (yes or no, or I don’t know): Yes

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No

I know somebody asked this question already but I have to use /opt/ directory as the outputted certificate stored over there. Of course I would like to take a workaround but I don’t know how.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.