python3-docker `from_env()` broken

Bug #2065348 reported by Greg Stewart
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-docker (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I have a python script that manages some docker resources. It uses the `from_env()` method to build the client. This script always runs as root.

This worked in Ubuntu 22.04. However, it seems like something is mismatched in 24.04, as I now get the following error, even after a reboot (which seemed to solve this for others in the past?). It appears based on cursory googling that a library version might be out of sync.

```
Traceback (most recent call last):
  File "/usr/bin/oqm-captain", line 62, in <module>
    ContainerUtils.ensureSharedDockerResources()
  File "/usr/lib/oqm/station-captain/ContainerUtils.py", line 55, in ensureSharedDockerResources
    client = docker.from_env()
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/docker/client.py", line 96, in from_env
    return cls(
           ^^^^
  File "/usr/lib/python3/dist-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: HTTPConnection.request() got an unexpected keyword argument 'chunked'
```

This is on a fresh 24.04 install.

Willing to help diagnose, but to replicate:

 1. `apt install docker.io python3-docker`
 2. `python3`
 3. `import docker`
 4. `docker.from_env()`

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-docker (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.