Self-Hosted Instance certbot/certbot issues

I am running a self hosted instance of bitwarden, and in the run.sh it pulls and calls the certbot/certbot container. However, the certbot/certbot:latest gives me an error during a bitwarden.sh update:

Status: Image is up to date for docker.io/certbot/certbot:latest
Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2897, in _dep_map
return self.__dep_map
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2691, in getattr
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2888, in _parsed_pkg_info
return self._pkg_info
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2691, in getattr
raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/bin/certbot”, line 6, in
from pkg_resources import load_entry_point
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 3127, in
def _initialize_master_working_set():
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 3110, in _call_aside
f(*args, **kwargs)
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 3139, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 581, in _build_master
ws.require(requires)
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 898, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 792, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2635, in requires
dm = self._dep_map
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2899, in _dep_map
self.__dep_map = self._compute_dependencies()
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2908, in _compute_dependencies
for req in self._parsed_pkg_info.get_all(‘Requires-Dist’) or []:
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 2890, in _parsed_pkg_info
metadata = self.get_metadata(self.PKG_INFO)
File “/usr/local/lib/python3.8/site-packages/pkg_resources/init.py”, line 1798, in get_metadata
raise KeyError(“No metadata except PKG-INFO is available”)
KeyError: ‘No metadata except PKG-INFO is available’

If I edit the run.sh and force certbot/certbot:v1.3.0 everything works. Any thoughts on what I would need to do to allow the current containers to execute.
Test method:
docker run -i --rm --name certbot -p 443:443 -p 80:80 -v /tmp/letsencrypt:/etc/letsencrypt/ certbot/certbot:v1.3.0 renew --logs-dir /etc/letsencrypt/logs
Will produce success.

docker run -i --rm --name certbot -p 443:443 -p 80:80 -v /tmp/letsencrypt:/etc/letsencrypt/ certbot/certbot:latest renew --logs-dir /etc/letsencrypt/logs
or
docker run -i --rm --name certbot -p 443:443 -p 80:80 -v /tmp/letsencrypt:/etc/letsencrypt/ certbot/certbot renew --logs-dir /etc/letsencrypt/logs

will produce failure.

Hello @JoeE,
what about auto generation of TLS certificates instead?

I have a repo (also proposed to Bitwarden directly) that is optimized and easier to use.
Just run ./init.sh, setup bitwarden email then run docker-compose up -d and thats it.
For update just change to the desired version in .env file and run docker-compose up -d.

I hope this will relieve you with the future problems like this one.

Cheers