jsmyth
(Jason Smyth)
May 4, 2023, 8:14pm
1
CMK version: Checkmk Raw Edition 2.1.0p20
OS version: Ubuntu 20.04 LTS
Error message: Plugin exception in MKDockerClient.__init__: Error while fetching server API version: request() got an unexpected keyword argument 'chunked'
Output of “cmk --debug -vvn hostname”: N/A
We have an issue running the Docker plugin specifically on Ubuntu 20.04 systems. The plugin works properly on both Ubuntu 18.04 and Ubuntu 22.04, but on 20.04 it returns the error message shown above.
The error message is the same when running the plugin script from the command prompt, regardless of whether or not the user executing the script has permissions to access the Docker daemon. It is also the same regardless of whether we use the latest (v6.0.1) version of the python docker library or a known-good version (v5.0.3).
Is this a known issue? Are there some troubleshooting steps we are missing?
Any help or advice is appreciated.
Thanks in advance,
Jason
jsmyth
(Jason Smyth)
May 4, 2023, 8:20pm
2
Based on this GitHub issue, it seems the issue is caused by recent versions of pip packages:
opened 07:09PM - 26 Apr 23 UTC
Minimal repro:
```python
Python 3.8.10 (default, Mar 13 2023, 10:26:41)
[G… CC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import docker
/opt/worker_venv/lib/python3.8/site-packages/requests/__init__.py:109: RequestsDependencyWarning: urllib3 (2.0.0) or chardet (None)/charset_normalizer (3.1.0) doesn't match a supported version!
warnings.warn(
>>> client = docker.from_env(version='auto')
Traceback (most recent call last):
File "/opt/worker_venv/lib/python3.8/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
return self.version(api_version=False)["ApiVersion"]
File "/opt/worker_venv/lib/python3.8/site-packages/docker/api/daemon.py", line 181, in version
return self._result(self._get(url), json=True)
File "/opt/worker_venv/lib/python3.8/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/opt/worker_venv/lib/python3.8/site-packages/docker/api/client.py", line 237, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/opt/worker_venv/lib/python3.8/site-packages/requests/sessions.py", line 600, in get
return self.request("GET", url, **kwargs)
File "/opt/worker_venv/lib/python3.8/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/opt/worker_venv/lib/python3.8/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/opt/worker_venv/lib/python3.8/site-packages/requests/adapters.py", line 487, in send
resp = conn.urlopen(
File "/opt/worker_venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/opt/worker_venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 496, in _make_request
conn.request(
TypeError: request() got an unexpected keyword argument 'chunked'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/worker_venv/lib/python3.8/site-packages/docker/client.py", line 96, in from_env
return cls(
File "/opt/worker_venv/lib/python3.8/site-packages/docker/client.py", line 45, in __init__
self.api = APIClient(*args, **kwargs)
File "/opt/worker_venv/lib/python3.8/site-packages/docker/api/client.py", line 197, in __init__
self._version = self._retrieve_server_version()
File "/opt/worker_venv/lib/python3.8/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: request() got an unexpected keyword argument 'chunked'
```
urllib3 2.0.0 just released today. A quick fix would be to pin to `urllib3<2`.
Running the following command downgraded the relevant packages and got the plugin working for us:
sudo pip3 install --force-reinstall 'requests<2.29.0' 'urllib3<2.0'
Hope this saves someone else some time if they run into the same issue.
Regards,
Jason
2 Likes
system
(system)
Closed
May 3, 2024, 8:20pm
3
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.