question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DockerException in batch model - Error while fetching server API version

See original GitHub issue

This might be a bug somewhere in the python docker package or it might be fixed upstream but moto[server] could use an update to any pinned dependency?

    
>       self.docker_client = docker.from_env()

/opt/conda/envs/project/lib/python3.7/site-packages/moto/batch/models.py:345: 

...

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

$ poetry show moto
name         : moto
version      : 1.3.16
description  : A library that allows your python tests to easily mock out the boto library

dependencies
 - aws-xray-sdk >=0.93,<0.96 || >0.96
 - boto >=2.36.0
 - boto3 >=1.9.201
 - botocore >=1.12.201
 - cfn-lint >=0.4.0
 - cryptography >=2.3.0
 - docker >=2.5.1
 - ecdsa <0.15
 - flask *
 - idna >=2.5,<3
 - Jinja2 >=2.10.1
 - jsondiff >=1.1.2
 - MarkupSafe <2.0
 - mock *
 - more-itertools *
 - python-dateutil >=2.1,<3.0.0
 - python-jose >=3.1.0,<4.0.0
 - pytz *
 - PyYAML >=5.1
 - requests >=2.5
 - responses >=0.9.0
 - six >1.9
 - werkzeug *
 - xmltodict *
 - zipp *

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16

github_iconTop GitHub Comments

1reaction
bblommerscommented, Jan 12, 2021

Thanks for providing the test, @maxwellchandler. Looks like it was only fixed in 1.3.16.dev122 instead. That release contains #3466, a fix for a downstream change in the Responses-library. No idea why that would affect Docker though…

Proof: https://github.com/bblommers/testdockerexception/runs/1688643905?check_suite_focus=true

That repo contains the test you provided, and runs it against various moto-versions. Note that the OSX-test always fails, because Github does not have Docker installed on their OSX machines.

0reactions
bblommerscommented, Oct 16, 2021

As far as I can tell, all bugs surrounding Docker-versions have been fixed for now, so I’ll close this. Let me know if I’ve missed anything.

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker.errors.DockerException: Error while fetching server API ...
In my case I got docker.errors.DockerException: Error while fetching server API version: (2, 'CreateFile', 'The system cannot find the file specified.') because ...
Read more >
DockerException: Error while fetching server API version
Hi, I am following the getting started example using docker. On windows (10 x64), I created a folder in 'Documents' and added the ......
Read more >
f'error while fetching server api version: {e}' docker ... - You.com
You can get that error when compose is not able to connect to docker via docker socket (if any other way for connection...
Read more >
DockerException in batch model - Error while fetching server ...
DockerException in batch model - Error while fetching server API version ... This might be a bug somewhere in the python docker package...
Read more >
How to fix docker.errors.DockerException: Error while fetching ...
DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found