docker-py: error while using docker for mac client 2.5.0.0
Using python 3.8.5 and docker-py version 4.3.1
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/docker/models/containers.py", line 887, in get
resp = self.client.api.inspect_container(container_id)
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/docker/api/container.py", line 771, in inspect_container
self._get(self._url("/containers/{0}/json", container)), True
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/docker/api/client.py", line 228, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/requests/sessions.py", line 543, in get
return self.request('GET', url, **kwargs)
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/requests/sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/requests/sessions.py", line 685, in send
r.content
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/requests/models.py", line 829, in content
self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
File "/Users/mmoskwa/.local/share/virtualenvs/lunchbox-5JMc0Mx2/lib/python3.8/site-packages/requests/models.py", line 754, in generate
raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 24
- Comments: 25 (7 by maintainers)
Commits related to this issue
- implement workaround for docker for mac problem fixes https://github.com/docker/docker-py/issues/2696 by catching exceptions. — committed to backtick-se/cowait by johanhenriksson 4 years ago
- implement workaround for docker for mac problem fixes https://github.com/docker/docker-py/issues/2696 by catching exceptions. — committed to backtick-se/cowait by johanhenriksson 4 years ago
- hack(devservices): A hacky workaround to make docker on mac work again This works around https://github.com/docker/for-mac/issues/5025 and https://github.com/docker/docker-py/issues/2696 — committed to getsentry/sentry by mitsuhiko 4 years ago
- hack(devservices): A hacky workaround to make docker on mac work again (#22250) This works around https://github.com/docker/for-mac/issues/5025 and https://github.com/docker/docker-py/issues/2696 — committed to getsentry/sentry by mitsuhiko 4 years ago
- ref: Remove workaround for docker sock in devservices.py (#53688) Initially created in https://github.com/getsentry/sentry/pull/22250 Both original issues are already solved for over 2.5 years: -... — committed to getsentry/sentry by kamilogorek a year ago
Hello, same/similar issue.
Python version: 3.8.6 Docker version: 2.5.0 docker-py version: 4.3.1 urllib3 version: 1.25.11
reproducer:
expected result: Exception at docker api level (
docker.errors.NotFound
ordocker.errors.APIError
)result:
We use this pattern to check if a container exists already before starting a container or when fetching the status of a container, as our software uses deterministic container names. In the case where the container isn’t running we catch
docker.errors.NotFound
, which is now broken as @mconcas points out. After initial testing, it does appear this is the only place in the API that is broken like this.A very temporary fix is catching the unexpected error, again this is unexpected, fragile, and possibly not useful for everyone’s use case:
Seeing the same issue using wsl1 on windows:
Python 3.8.2 Linux 5.4.39-linuxkit x86_64 Docker version 18.09.1, build 4c52b90 docker-py 4.3.1
This should be fixed in docker desktop 2.5.2 and up;
Oh, actually, there might be a workaround; the “raw” socket is also available on the mac side in;
e.g.;
☝️ ☝️ ☝️ ☝️ IOW: the recommended socket to use will be
/var/run/docker.sock
, which is the official API to connect (for reasons above).Mac facing the same problem 😃 hope it gets resolved! thanks guys
An interesting observation on various version. I’m seeing this same issue on:
I do not see this issue on: