Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-py not working with requests-2.12.2 #1321

Closed
tangyouze opened this issue Nov 30, 2016 · 12 comments
Closed

docker-py not working with requests-2.12.2 #1321

tangyouze opened this issue Nov 30, 2016 · 12 comments

Comments

@tangyouze
Copy link

tangyouze commented Nov 30, 2016

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
kennethreitz/requests@v2.12.1...v2.12.2

in this commit

kennethreitz/requests@34af72c#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"}'")

@tangyouze
Copy link
Author

tangyouze commented Nov 30, 2016

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

@graingert
Copy link
Contributor

graingert commented Nov 30, 2016

@Lukasa ^

@graingert
Copy link
Contributor

@graingert So it looks like our patch to stop preparing non-HTTP-schemed URLs broke this. Specifically, the scheme is http+docker.
@graingert I’m not immediately certain that this is wrong. Given that http+docker may contain non-hostnames, IDNA-encoding would be wrong.

From @Lukasa via twitter

@Lukasa
Copy link

Lukasa commented Nov 30, 2016

Relevant Requests issue is kennethreitz/requests#3734. Temporary workaround is to pin to v2.12.1.

graingert added a commit to graingert/docker-py that referenced this issue Nov 30, 2016
Fixes docker#1321
be compatable with requests 2.12.2
graingert added a commit to graingert/docker-py that referenced this issue Nov 30, 2016
Fixes docker#1321
be compatable with requests 2.12.2

Signed-off-by: Thomas Grainger <tom.grainger@procensus.com>
@shin-
Copy link
Contributor

shin- commented Nov 30, 2016

Thank you for the report folks - we'll exclude requests 2.12.2 in setup.py for the time being.

@graingert
Copy link
Contributor

@shin- you might want to exclude 2.12.0-2.12.2 not sure though

@Lukasa
Copy link

Lukasa commented Dec 1, 2016

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.

georgevreilly pushed a commit to xBrite/flyingcloud that referenced this issue Dec 1, 2016
See docker/docker-py#1321

Also, sh 1.12.2 fixes the UnsupportedOperation regression of 1.12.
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Dec 2, 2016
Project: openstack/requirements  2878a8c934350073f01d3261708c0aec539bcd2e

Block version of requests==2.12.2

This version breaks docker-py totally, as explained here:
docker/docker-py#1321

Change-Id: I915b252e462958167a1dbc0840bdb1e6b4f27431
openstack-gerrit pushed a commit to openstack/requirements that referenced this issue Dec 2, 2016
This version breaks docker-py totally, as explained here:
docker/docker-py#1321

Change-Id: I915b252e462958167a1dbc0840bdb1e6b4f27431
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Dec 2, 2016
Project: openstack/requirements  2878a8c934350073f01d3261708c0aec539bcd2e

Block version of requests==2.12.2

This version breaks docker-py totally, as explained here:
docker/docker-py#1321

Change-Id: I915b252e462958167a1dbc0840bdb1e6b4f27431
@agherzan
Copy link

agherzan commented Dec 8, 2016

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.

@shin-
Copy link
Contributor

shin- commented Dec 8, 2016

2.0 should come out soon.

@agherzan
Copy link

agherzan commented Dec 8, 2016

Please update here as soon as it happens. Thanks @shin-

agherzan pushed a commit to balena-os/balenahup that referenced this issue Dec 9, 2016
…with dockerpy

Ref.:
docker/docker-py#1321

Signed-off-by: Andrei Gherzan <andrei@resin.io>
@westsouthnight
Copy link

Please help, no one workaround not works

@agherzan
Copy link

@westsouthnight you already have an workaround: use requests 2.12.3

michal-mazurek pushed a commit to balena-os/balenahup that referenced this issue Jan 3, 2017
…with dockerpy

Ref.:
docker/docker-py#1321

Signed-off-by: Andrei Gherzan <andrei@resin.io>
@shin- shin- closed this as completed Jan 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants