docker / docker/docker-py

DockerException: Error while fetching server API version

Open
#2,717 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
1.7k
Avg merge
13d 8h
Merged PRs (30d)
2

Description

Could be a bug in 4.4.0 release?

self = <docker.api.client.APIClient object at 0x7f8b52ceec90>

    def _retrieve_server_version(self):
        try:
            return self.version(api_version=False)["ApiVersion"]
        except KeyError:
            raise DockerException(
                'Invalid response from docker daemon: key "ApiVersion"'
                ' is missing.'
            )
        except Exception as e:
            raise DockerException(
>               'Error while fetching server API version: {0}'.format(e)
            )
E           docker.errors.DockerException: Error while fetching server API version: cannot unpack non-iterable CallbackResponse object

/opt/conda/envs/project/lib/python3.7/site-packages/docker/api/client.py:222: DockerException

versions
$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

$ docker --version
Docker version 19.03.14, build 5eb3275d40

$ service docker status
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-12-03 16:13:07 PST; 1h 26min ago
     Docs: https://docs.docker.com
 Main PID: 1844 (dockerd)
    Tasks: 10
   CGroup: /system.slice/docker.service
           └─1844 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

$ python --version
Python 3.7.8

$ poetry --version
Poetry version 1.1.4

$ poetry show docker
name         : docker
version      : 4.4.0
description  : A Python library for the Docker Engine API.

dependencies
 - pywin32 227
 - requests >=2.14.2,<2.18.0 || >2.18.0
 - six >=1.4.0
 - websocket-client >=0.32.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at docker/api/client.py:222, especially _retrieve_server_version and its version(api_version=False) call, using the listed Docker 4.4.0 and Python 3.7.8 environment. Trace the CallbackResponse unpacking failure and compare the Docker daemon response; done means the server API version is fetched without this exception and the behavior is covered by a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.