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.

docker-py not working with requests-2.12.2

See original GitHub issue

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"}'")

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Lukasacommented, Nov 30, 2016

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

1reaction
agherzancommented, Dec 15, 2016

@westsouthnight you already have an workaround: use requests 2.12.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · docker/docker-py - GitHub
A Python library for the Docker Engine API. Contribute to docker/docker-py development by creating an account on GitHub.
Read more >
docker python requests not working - You.com | The AI Search ...
Problem. I have a 2-container docker-compose.yml file. One of the containers is a small FastAPI app. The other is just trying to hit...
Read more >
Change Log - docker-py Documentation
When a resource identifier (image or container ID) is passed to a Client method, we now check for None values to avoid crashing...
Read more >
python 3.x - GET request not responding in docker container
I often use python requests inside my python containers, and have come across this problem a couple of times.
Read more >
docker-sdk-python Documentation - Read the Docs
To communicate with the Docker daemon, you first need to instantiate a client. The easiest way to do that is by calling.
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