I'm not sure whether it's requests' issue or something change should be made in docker-py
requests-2.12.1 works fine
It might be something related with
requests/models.py line 350 in
https://github.com/kennethreitz/requests/compare/v2.12.1...v2.12.2
in this commit
https://github.com/kennethreitz/requests/commit/34af72c87d79bd8852e8564c050dd7711c6a08d6#diff-afd5aad80649cdfae687bee05242c8fa
import docker
import os
import requests
print(requests.__version__)
print(docker.__version__)
os.system('docker version')
client = docker.AutoVersionClient()
client.tag('ubuntu', 'ubuntu-test')
~/qb/qb_playground > python docker-client.py
2.12.2
1.10.6
Client:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 21:44:32 2016
OS/Arch: linux/amd64
Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 21:44:32 2016
OS/Arch: linux/amd64
Traceback (most recent call last):
File "/home/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/docker/client.py", line 170, in _raise_for_status
response.raise_for_status()
File "/home/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/requests/models.py", line 893, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localunixsocket/v1.24/images/ubuntu/tag
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "docker-client.py", line 8, in <module>
client.tag('ubuntu', 'ubuntu-test')
File "/home/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/docker/utils/decorators.py", line 21, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/home/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/docker/api/image.py", line 240, in tag
self._raise_for_status(res)
File "/home/tyz/.pyenv/versions/3.5.0/lib/python3.5/site-packages/docker/client.py", line 174, in _raise_for_status
raise errors.APIError(e, response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("b'{"message":"invalid reference format"}'")
I found in the requirements.txt, it specify a requests version, however in setup.py it doesn't. So I use
pip install docker-py -U
causes an incorrect requests version installed
@lukasa ^
@graingert So it looks like our patch to stop preparing non-HTTP-schemed URLs broke this. Specifically, the scheme is http+docker.
@graingert I鈥檓 not immediately certain that this is wrong. Given that http+docker may contain non-hostnames, IDNA-encoding would be wrong.
From @lukasa via twitter
Relevant Requests issue is kennethreitz/requests#3734. Temporary workaround is to pin to v2.12.1.
Thank you for the report folks - we'll exclude requests 2.12.2 in setup.py for the time being.
@shin- you might want to exclude 2.12.0-2.12.2 not sure though
I think for the way docker-py uses Requests 2.12.{0,1} are safe: docker-py uses a hardcoded ACSII hostname that shouldn't be at any risk of breaking.
Confirm I hit the same issue. Upgrading to 2.12.3 fixed the problem. When are we going to have this change in pip packages? I mean a new version there that would fix this issue.
2.0 should come out soon.
Please update here as soon as it happens. Thanks @shin-
Please help, no one workaround not works
@westsouthnight you already have an workaround: use requests 2.12.3
Most helpful comment
Relevant Requests issue is kennethreitz/requests#3734. Temporary workaround is to pin to v2.12.1.