Breaks with requests 2.32.0: Not supported URL scheme http+docker
rra opened this issue ยท 63 comments
With requests 2.32.0 (released about an hour ago as I write this), the docker library as called by tox-docker fails with the following exception:
Traceback (most recent call last):
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/requests/adapters.py", line 532, in send
conn = self._get_connection(request, verify, proxies=proxies, cert=cert)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/requests/adapters.py", line 400, in _get_connection
conn = self.poolmanager.connection_from_host(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/urllib3/poolmanager.py", line 304, in connection_from_host
return self.connection_from_context(request_context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/urllib3/poolmanager.py", line 326, in connection_from_context
raise URLSchemeUnknown(scheme)
urllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+docker
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/api/client.py", line 214, in _retrieve_server_version
return self.version(api_version=False)["ApiVersion"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/api/daemon.py", line 181, in version
return self._result(self._get(url), json=True)
^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/api/client.py", line 237, in _get
return self.get(url, **self._set_request_timeout(kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/requests/adapters.py", line 534, in send
raise InvalidURL(e, request=request)
requests.exceptions.InvalidURL: Not supported URL scheme http+docker
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/tox/session/cmd/run/single.py", line 48, in _evaluate
code, outcomes = run_commands(tox_env, no_test)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/tox/session/cmd/run/single.py", line 79, in run_commands
MANAGER.tox_before_run_commands(tox_env)
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/tox/plugin/manager.py", line 88, in tox_before_run_commands
self.manager.hook.tox_before_run_commands(tox_env=tox_env)
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/pluggy/_hooks.py", line 513, in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/pluggy/_manager.py", line 120, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/pluggy/_callers.py", line 139, in _multicall
raise exception.with_traceback(exception.__traceback__)
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/pluggy/_callers.py", line 103, in _multicall
res = hook_impl.function(*args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/tox_docker/tox4/plugin.py", line 73, in tox_before_run_commands
docker_build_or_pull(container_config, log)
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/tox_docker/plugin.py", line 57, in docker_build_or_pull
docker_pull(container_config, log)
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/tox_docker/plugin.py", line 65, in docker_pull
docker = docker_module.from_env(version="auto")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/client.py", line 96, in from_env
return cls(
^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/client.py", line 45, in __init__
self.api = APIClient(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/api/client.py", line 197, in __init__
self._version = self._retrieve_server_version()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eagle/dvl/venvs/gafaelfawr/lib/python3.12/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker
Reverting to requests 2.31.0 without any other changes fixes the problem.
same problem
In [1]: import docker
...: client = docker.from_env()
---------------------------------------------------------------------------
URLSchemeUnknown Traceback (most recent call last)
File /usr/local/lib/python3.8/dist-packages/requests/adapters.py:532, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
531 try:
--> 532 conn = self._get_connection(request, verify, proxies=proxies, cert=cert)
533 except LocationValueError as e:
File /usr/local/lib/python3.8/dist-packages/requests/adapters.py:400, in HTTPAdapter._get_connection(self, request, verify, proxies, cert)
398 else:
399 # Only scheme should be lower case
--> 400 conn = self.poolmanager.connection_from_host(
401 **host_params, pool_kwargs=pool_kwargs
402 )
404 return conn
File /usr/local/lib/python3.8/dist-packages/urllib3/poolmanager.py:304, in PoolManager.connection_from_host(self, host, port, scheme, pool_kwargs)
302 request_context["host"] = host
--> 304 return self.connection_from_context(request_context)
File /usr/local/lib/python3.8/dist-packages/urllib3/poolmanager.py:326, in PoolManager.connection_from_context(self, request_context)
325 if not pool_key_constructor:
--> 326 raise URLSchemeUnknown(scheme)
327 pool_key = pool_key_constructor(request_context)
URLSchemeUnknown: Not supported URL scheme http+docker
During handling of the above exception, another exception occurred:
InvalidURL Traceback (most recent call last)
File /usr/local/lib/python3.8/dist-packages/docker/api/client.py:213, in APIClient._retrieve_server_version(self)
212 try:
--> 213 return self.version(api_version=False)["ApiVersion"]
214 except KeyError as ke:
File /usr/local/lib/python3.8/dist-packages/docker/api/daemon.py:181, in DaemonApiMixin.version(self, api_version)
180 url = self._url("/version", versioned_api=api_version)
--> 181 return self._result(self._get(url), json=True)
File /usr/local/lib/python3.8/dist-packages/docker/utils/decorators.py:44, in update_headers.<locals>.inner(self, *args, **kwargs)
43 kwargs['headers'].update(self._general_configs['HttpHeaders'])
---> 44 return f(self, *args, **kwargs)
File /usr/local/lib/python3.8/dist-packages/docker/api/client.py:236, in APIClient._get(self, url, **kwargs)
234 @update_headers
235 def _get(self, url, **kwargs):
--> 236 return self.get(url, **self._set_request_timeout(kwargs))
File /usr/local/lib/python3.8/dist-packages/requests/sessions.py:602, in Session.get(self, url, **kwargs)
601 kwargs.setdefault("allow_redirects", True)
--> 602 return self.request("GET", url, **kwargs)
File /usr/local/lib/python3.8/dist-packages/requests/sessions.py:589, in Session.request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
588 send_kwargs.update(settings)
--> 589 resp = self.send(prep, **send_kwargs)
591 return resp
File /usr/local/lib/python3.8/dist-packages/requests/sessions.py:703, in Session.send(self, request, **kwargs)
702 # Send the request
--> 703 r = adapter.send(request, **kwargs)
705 # Total elapsed time of the request (approximately)
File /usr/local/lib/python3.8/dist-packages/requests/adapters.py:534, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
533 except LocationValueError as e:
--> 534 raise InvalidURL(e, request=request)
536 self.cert_verify(conn, request.url, verify, cert)
InvalidURL: Not supported URL scheme http+docker
The above exception was the direct cause of the following exception:
DockerException Traceback (most recent call last)
Cell In[1], line 2
1 import docker
----> 2 client = docker.from_env()
File /usr/local/lib/python3.8/dist-packages/docker/client.py:94, in DockerClient.from_env(cls, **kwargs)
92 version = kwargs.pop('version', None)
93 use_ssh_client = kwargs.pop('use_ssh_client', False)
---> 94 return cls(
95 timeout=timeout,
96 max_pool_size=max_pool_size,
97 version=version,
98 use_ssh_client=use_ssh_client,
99 **kwargs_from_env(**kwargs)
100 )
File /usr/local/lib/python3.8/dist-packages/docker/client.py:45, in DockerClient.__init__(self, *args, **kwargs)
44 def __init__(self, *args, **kwargs):
---> 45 self.api = APIClient(*args, **kwargs)
File /usr/local/lib/python3.8/dist-packages/docker/api/client.py:197, in APIClient.__init__(self, base_url, version, timeout, tls, user_agent, num_pools, credstore_env, use_ssh_client, max_pool_size)
192 # version detection needs to be after unix adapter mounting
193 if version is None or (isinstance(
194 version,
195 str
196 ) and version.lower() == 'auto'):
--> 197 self._version = self._retrieve_server_version()
198 else:
199 self._version = version
File /usr/local/lib/python3.8/dist-packages/docker/api/client.py:220, in APIClient._retrieve_server_version(self)
215 raise DockerException(
216 'Invalid response from docker daemon: key "ApiVersion"'
217 ' is missing.'
218 ) from ke
219 except Exception as e:
--> 220 raise DockerException(
221 f'Error while fetching server API version: {e}'
222 ) from e
DockerException: Error while fetching server API version: Not supported URL scheme http+docker
pip list
Package Version
---------------------- --------------------
asttokens 2.4.1
attrs 19.3.0
Automat 0.8.0
backcall 0.2.0
blinker 1.4
certifi 2019.11.28
chardet 3.0.4
charset-normalizer 3.3.2
Click 7.0
cloud-init 22.2
colorama 0.4.3
command-not-found 0.3
configobj 5.0.6
constantly 15.1.0
cryptography 2.8
dbus-python 1.2.16
decorator 5.1.1
distro 1.4.0
distro-info 0.23ubuntu1
docker 7.0.0
entrypoints 0.3
executing 2.0.1
httplib2 0.14.0
hyperlink 19.0.0
idna 2.8
importlib-metadata 1.5.0
incremental 16.10.1
ipython 8.12.3
jedi 0.19.1
Jinja2 2.10.1
jsonpatch 1.22
jsonpointer 2.0
jsonschema 3.2.0
keyring 18.0.1
language-selector 0.1
launchpadlib 1.10.13
lazr.restfulclient 0.14.2
lazr.uri 1.0.3
MarkupSafe 1.1.0
matplotlib-inline 0.1.7
more-itertools 4.2.0
netifaces 0.10.4
oauthlib 3.1.0
packaging 24.0
parso 0.8.4
pexpect 4.6.0
pickleshare 0.7.5
pip 20.0.2
prompt-toolkit 3.0.43
pure-eval 0.2.2
pyasn1 0.4.2
pyasn1-modules 0.2.1
pygments 2.18.0
PyGObject 3.36.0
PyHamcrest 1.9.0
PyJWT 1.7.1
pymacaroons 0.13.0
PyNaCl 1.3.0
pyOpenSSL 19.0.0
pyrsistent 0.15.5
pyserial 3.4
python-apt 2.0.0+ubuntu0.20.4.7
python-debian 0.1.36ubuntu1
PyYAML 5.3.1
requests 2.32.0
requests-unixsocket 0.2.0
SecretStorage 2.3.1
service-identity 18.1.0
setuptools 45.2.0
simplejson 3.16.0
six 1.14.0
sos 4.3
ssh-import-id 5.10
stack-data 0.6.3
systemd-python 234
traitlets 5.14.3
Twisted 18.9.0
typing-extensions 4.11.0
ubuntu-advantage-tools 27.9
ufw 0.36
unattended-upgrades 0.1
urllib3 2.2.1
wadllib 1.3.3
wcwidth 0.2.13
wheel 0.34.2
zipp 1.0.0
zope.interface 4.7.1
same!
I'm currently debugging this a bit (ansible-collections/community.docker#860), the issue is commit psf/requests@c0813a2 in requests.
Ok, this isn't very surprising, since that commit makes
send()call_get_connection()instead ofget_connection(). Now the Docker SDK for Python code overwritesget_connection(), but of course doesn't magically overwrite_get_connection()as well...
See for example https://github.com/docker/docker-py/blob/main/docker/transport/unixconn.py#L66.
A simple fix is adding
def _get_connection(self, request, *args, proxies=None, **kwargs):
return self.get_connection(request.url, proxies)at the bottom of https://github.com/docker/docker-py/blob/main/docker/transport/basehttpadapter.py.
Not sure how sustainable that is, but it works for now :)
I created #3257 with that fix.
same issue here, the fix from @felixfontein works for me!
for now I just replaced the dependency docker for git+https://github.com/felixfontein/docker-py@requests-hotfix
Ditto here :)
Just saw lots of builds start failing, glad there's already a fix... and it seems the CI build is failing already, but unrelated to the fix above.
haha Seems a lot of CI fails cause this issue. me tooooooo.
Our team wasted all day today trying to triage and put a fix to this problem. After this incident, is there any plan to revisit this unpinned dependency specification:
Line 33 in b6464db
Pinning dependencies, in particular very general dependencies such as requests, generally causes a lot more problems than it solves. The best place where to pin dependencies is at the end of the chain, i.e. where the venv is created that contains all the Python libraries and programs that you need.
Pinning dependencies, in particular very general dependencies such as
requests, generally causes a lot more problems than it solves. The best place where to pin dependencies is at the end of the chain, i.e. where the venv is created that contains all the Python libraries and programs that you need.
In our process, we had pinned to docker==6.0.0 but did not realize we had to pin requests also.
If you only pin direct dependencies, you're usually missing A LOT of indirect dependencies that can cause all kind of problems - such as in this case.
You might want to use pip freeze (https://pip.pypa.io/en/stable/cli/pip_freeze/) or pip-tools (https://pypi.org/project/pip-tools/) to pin all dependencies. Especially with pip-tools you can create a workflow that pins everything, and you have a CI workflow that regularly tries to upgrades dependencies and checks whether the result passes CI. Also check out Renovate (https://github.com/renovatebot/renovate) and Dependabot, which help a lot with that.
So now the question is, do i
- Pin the version of requests to <2.32.0 in my package?
- Wait for docker-py to release a fix?
- Wait for requests to release a fix?
I can't make a decision :p help! What would you do?
- Pin the version of requests to <2.32.0 in my package
Fastest option RN
@milas I saw you approved the latest PR:s to this repo.
Do you have any information on if we could expect this to be fixed and released anytime soon?
Half of the internet is broken now... ansible, docker etc.
requests 2.32.2 is just out now which seems to fix this compatibility break. They have issued a warning now that the problematic
get_connectionis now marked as deprecated but still working as before 2.32.0, with an urge to use the newget_connection_with_tls_contextin future releases. See requests PR psf/requests#6710 which is included in release 2.32.2
requests 2.32.2 + docker 6.1.1 is still not working for me:
pip3 list | egrep '(docker|requests)'
docker 6.1.1
requests 2.31.0
>>> import docker
>>> client = docker.from_env()
>>>
Now, updating to requests 2.32.2
pip3 list | egrep '(docker|requests)'
docker 6.1.1
requests 2.32.2
>>> import docker
>>> client = docker.from_env()
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/requests/adapters.py", line 555, in send
conn = self.get_connection_with_tls_context(
File "/usr/local/lib/python3.9/dist-packages/requests/adapters.py", line 411, in get_connection_with_tls_context
conn = self.poolmanager.connection_from_host(
File "/usr/local/lib/python3.9/dist-packages/urllib3/poolmanager.py", line 304, in connection_from_host
return self.connection_from_context(request_context)
File "/usr/local/lib/python3.9/dist-packages/urllib3/poolmanager.py", line 326, in connection_from_context
raise URLSchemeUnknown(scheme)
urllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+docker
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version
return self.version(api_version=False)["ApiVersion"]
File "/usr/local/lib/python3.9/dist-packages/docker/api/daemon.py", line 181, in version
return self._result(self._get(url), json=True)
File "/usr/local/lib/python3.9/dist-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 237, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/dist-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/requests/adapters.py", line 559, in send
raise InvalidURL(e, request=request)
requests.exceptions.InvalidURL: Not supported URL scheme http+docker
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/docker/client.py", line 96, in from_env
return cls(
File "/usr/local/lib/python3.9/dist-packages/docker/client.py", line 45, in __init__
self.api = APIClient(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 197, in __init__
self._version = self._retrieve_server_version()
File "/usr/local/lib/python3.9/dist-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker
Hi. We just wanted to report back that even with requests-2.32.2, we are observing this error on our CI jobs.
urllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+docker-- https://github.com/crate/crash/actions/runs/9167762905/job/25250202248#step:5:526
Ah, right. psf/requests#6707 (comment) has the answer that docker-py also needs a patch.
requests 2.32.2 made the new interface public, but Docker SDK for Python still needs to support it first. Right now it does not, there's a PR for it, and that (or something equivalent) needs to be merged and a new release of Docker SDK for Python has to be made. Otherwise you need to restrict to requests < 2.32.0.
Dear Felix. We appreciate you following the case and submitting a corresponding patch. We are looking forward that it will be merged soon, and released on behalf of a relevant bugfix release.
so what is the final verdict i still cant run the code
this is one of those cases where every solution is a bad one
So what to do now?
im:
- pinning requests<2.32
- unsubscribing from this thread
- re-evaluating life
Sorry for the delay, we had some unexpected complications to manage for this release.
Version 7.1.0 should now be live on pypi, thx for the patience <3
Hello, just testing requests-2.32.2 with docker-py-7.1.0 and it does not seem to work for me, same error.
Hello, just testing requests-2.32.2 with docker-py-7.1.0 and it does not seem to work for me, same error.
Could it be a caching issue? If not, could you provide steps to reproduce the issue?
Tests on my end show the new version working as expected
Still have the issue as well:
ansible==9.5.1
ansible-compat==24.5.1
ansible-core==2.16.6
ansible-lint==24.5.0
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
attrs==23.2.0
black==24.4.2
bracex==2.4
certifi==2024.2.2
cffi==1.16.0
charset-normalizer==3.3.2
click==8.1.7
cryptography==42.0.7
dnspython==2.6.1
docker==7.1.0 <-----
filelock==3.14.0
idna==3.7
importlib_metadata==7.1.0
Jinja2==3.1.4
jmespath==1.0.1
jsonschema==4.22.0
jsonschema-specifications==2023.12.1
lxml==5.2.2
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
mypy-extensions==1.0.0
ndg-httpsclient==0.5.1
netaddr==1.2.1
packaging==24.0
passlib==1.7.4
pathspec==0.12.1
platformdirs==4.2.2
pyasn1==0.6.0
pycparser==2.22
Pygments==2.18.0
PyMySQL==1.1.0
pyOpenSSL==24.1.0
PyYAML==6.0.1
referencing==0.35.1
requests==2.32.2 <-----
resolvelib==1.0.1
rich==13.7.1
rpds-py==0.18.1
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
setuptools==69.5.1
subprocess-tee==0.4.1
tld==0.13
urllib3==2.2.1
wcmatch==8.5.2
wheel==0.43.0
yamllint==1.35.1
zipp==3.18.2
Ansible returning the error: Error connecting: Error while fetching server API version: Not supported URL scheme http+docker
Still have the issue as well:
ansible==9.5.1 ansible-compat==24.5.1 ansible-core==2.16.6 ansible-lint==24.5.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 attrs==23.2.0 black==24.4.2 bracex==2.4 certifi==2024.2.2 cffi==1.16.0 charset-normalizer==3.3.2 click==8.1.7 cryptography==42.0.7 dnspython==2.6.1 docker==7.1.0 <----- filelock==3.14.0 idna==3.7 importlib_metadata==7.1.0 Jinja2==3.1.4 jmespath==1.0.1 jsonschema==4.22.0 jsonschema-specifications==2023.12.1 lxml==5.2.2 markdown-it-py==3.0.0 MarkupSafe==2.1.5 mdurl==0.1.2 mypy-extensions==1.0.0 ndg-httpsclient==0.5.1 netaddr==1.2.1 packaging==24.0 passlib==1.7.4 pathspec==0.12.1 platformdirs==4.2.2 pyasn1==0.6.0 pycparser==2.22 Pygments==2.18.0 PyMySQL==1.1.0 pyOpenSSL==24.1.0 PyYAML==6.0.1 referencing==0.35.1 requests==2.32.2 <----- resolvelib==1.0.1 rich==13.7.1 rpds-py==0.18.1 ruamel.yaml==0.18.6 ruamel.yaml.clib==0.2.8 setuptools==69.5.1 subprocess-tee==0.4.1 tld==0.13 urllib3==2.2.1 wcmatch==8.5.2 wheel==0.43.0 yamllint==1.35.1 zipp==3.18.2Ansible returning the error:
Error connecting: Error while fetching server API version: Not supported URL scheme http+docker
Same as @saltydk, this error was returned from Ansible:
- name: Pull docker image
community.docker.docker_image:
name: "{{ graylog_docker_image }}:{{ graylog_docker_tag }}"
source: pull
we faicing same issue as described above on last version.
plz fix ASAP
Issue persists with Error connecting: Error while fetching server API version: Not supported URL scheme http+docker [0.0s]
requests==2.32.2
websocket-client==0.54.0
urllib3==1.26.18
docker[ssh]==7.1.0
paramiko==2.12.0
python-dotenv==0.21.1
texttable==0.9.1
distro==1.9.0
dockerpty==0.4.1
docopt==0.6.2
jsonschema==3.2.0
pyyaml==5.4.1
docker-compose==1.29.2
we faicing same issue as described above on last version.
plz fix ASAP
Any steps to reproduce the issue? @p2p-solutions @hydrapolic @saltydk @ilanKeshet
@felixfontein do ansible / community.docker need any updating?
Here is an example where it is still failing, despite using the new versions of requests and docker-py.
Here is an example where it is still failing, despite using the new versions of
requestsanddocker-py.
Sorry @jsf9k, I gave a very quick look at your project and it seems it does not depend on docker-py. Apparently you (like the other above mentioning issues) are using ansible to do some things with docker, so that's an issue for the ansible project or the ansible community's modules and plugins for docker.
This might be the correct place to ask for help: https://github.com/ansible-collections/community.docker
I understand you might've seen the error mentioned in this thread pop up in your logs so you ended up here. Many projects depend on this library so they might also have to be updated to use the 7.1.0 version of the docker library to avoid this issue.
In some cases, it might be enough to reinstall the affected packages, in other cases changes to the projects using docker might be needed.
To be able to diagnose any further issues with docker-py, it'd help a ton to have a simple example project that we can run on our machines to reproduce the problem.
Hope this helps โ๏ธ
Happened to me as well.
Downgrading requests to a version less then 2.32.2 fixed it
I did it using poetry poetry add "requests<2.32.2" which installed version 2.31.0
We had the same problem with ansible docker while using the below
- name: community.docker
version: 2.7.0
My coworker saw this fix ansible-collections/community.docker#864.
She updated to version 3.10.2 and it seems it solved the problem.
we faicing same issue as described above on last version.
plz fix ASAPAny steps to reproduce the issue? @p2p-solutions @hydrapolic @saltydk @ilanKeshet
@felixfontein do ansible / community.docker need any updating?
@krissetto community.docker 3.10.2 has that fix for its vendored Docker SDK for Python code since a few hours after requests 2.32.2 was released. The modules in it that use the 'real' Docker SDK for Python (mostly the Docker Swarm modules) should only still fail if Docker SDK for Python hasn't been upgraded, but everything else should just work.
I've seen some reports that folks are still seeing that error with community.docker 3.10.2 with modules using the vendored Docker SDK for Python parts, but I cannot reproduce it (and CI cannot either).
(In any case, now with the latest Docker SDK for Python released, CI is green except in cases which fail for some ansible-test pip proxy reasons...)
In case anyone is using the ansible package, you need to manually upgrade community.docker to 3.10.2. The version included in Ansible 9.6.0, community.docker 3.10.1, only has a fix for requests 2.32.0 and 2.32.1 since it got released before the changes for requests 2.32.2 were made (the Ansible 9.6.0 release also happened shortly before the requests changes were made).
If you need to use community.docker as part of the Ansible community package (https://pypi.org/project/ansible/), you have to stick to requests < 2.32.2 until the next Ansible release (Ansible 9.7.0 roughly in four weeks, and Ansible 10.0.0 one or two weeks before that).
I got the same error too. Seems like this has broken the internet. downgraded to 2.31 and it worked.
For me, setting docker==7.1.0 fixed it.
The developers released a fix a within a few days, in version 7.1.0. Setting requests==2.31.0 didn't work for me.
I suspect that many of the reports here saying the problem wasn't fixed may be due to some other package pinning the docker library to an older version. For example, tox-docker currently pins to <7, which prevents the new version with the fix from being used. (This is already tracked in tox-dev/tox-docker#181.)
For those still having problems, making sure, using pip list or the like, that you really have version 7.1.0 of the docker library.
I suspect that many of the reports here saying the problem wasn't fixed may be due to some other package pinning the docker library to an older version. For example, tox-docker currently pins to <7, which prevents the new version with the fix from being used. (This is already tracked in tox-dev/tox-docker#181.)
For those still having problems, making sure, using
pip listor the like, that you really have version 7.1.0 of the docker library.
Look, you only suspect that because it's obviously true.
A simple fix is adding
def _get_connection(self, request, *args, proxies=None, **kwargs): return self.get_connection(request.url, proxies)at the bottom of https://github.com/docker/docker-py/blob/main/docker/transport/basehttpadapter.py.
Not sure how sustainable that is, but it works for now :)
For those who use Debian and have docker-py installed via apt (package python3-docker), the file to edit is:
/usr/lib/python3/dist-packages/docker/transport/basehttpadapter.py
You should also add
def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None):
return self.get_connection(request.url, proxies)at the bottom for full compatibility with all requests versions >= 2.32.0.
pip install requests==2.31 got me past this problem
I had this issue when trying to run WebODM in a container and found that removing 'docker-compose' and making sure 'docker-compose-plugin' was installed using apt made everything launch correctly. I'm not sure if that helps narrow down the problem for anyone else.
I am still facing this error
Successfully installed requests-2.32.3
stack from console
docker-compose up -d
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/adapters.py", line 633, in send
conn = self.get_connection_with_tls_context(
File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/adapters.py", line 489, in get_connection_with_tls_context
conn = self.poolmanager.connection_from_host(
File "/home/ubuntu/.local/lib/python3.10/site-packages/urllib3/poolmanager.py", line 303, in connection_from_host
return self.connection_from_context(request_context)
File "/home/ubuntu/.local/lib/python3.10/site-packages/urllib3/poolmanager.py", line 325, in connection_from_context
raise URLSchemeUnknown(scheme)
urllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+docker
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 214, in _retrieve_server_version
return self.version(api_version=False)["ApiVersion"]
File "/usr/lib/python3/dist-packages/docker/api/daemon.py", line 181, in version
return self._result(self._get(url), json=True)
File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 237, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/sessions.py", line 602, in get
return self.request("GET", url, **kwargs)
File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/adapters.py", line 637, in send
raise InvalidURL(e, request=request)
requests.exceptions.InvalidURL: Not supported URL scheme http+docker
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 33, in
sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main
command_func()
File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command
project = project_from_options('.', options)
File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options
return get_project(
File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project
client = get_client(
File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client
client = docker_client(
File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 170, in docker_client
client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs)
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 197, in init
self._version = self._retrieve_server_version()
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker
Hi,
Update also 'urllib' to '2.2.2'.
Its still error
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 33, in
sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main
command_func()
File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 200, in perform_command
project = project_from_options('.', options)
File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in project_from_options
return get_project(
File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 152, in get_project
client = get_client(
File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 41, in get_client
client = docker_client(
File "/usr/lib/python3/dist-packages/compose/cli/docker_client.py", line 170, in docker_client
client = APIClient(use_ssh_client=not use_paramiko_ssh, **kwargs)
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 197, in init
self._version = self._retrieve_server_version()
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 221, in _retrieve_server_version
raise DockerException(
docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker
npm list urllib
โโโ urllib@2.2.2
faced with the same problem with the same console output
docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker
Docker Compose version v2.18.1
requests-2.32.3
urllib-2.2.2
I faced the same problem.
This problem was avoided by lowering the version of requests and the version of docker.
In case someone are interested, here is the version that worked, in my environment.
Docker Version: 24.0.6
Docker Compose Version: v2.22.0
requests version: 2.28.2
Any plans to have future docker-py versions support requests version > 2.32? I want to get notified on a fix when that happens
What version of docker-py are you using? I think this should be fixed by #3257 (comment) ?
I seem to be hitting this with:
certifi-2024.7.4 charset-normalizer-3.3.2 docker-7.1.0 idna-3.7 requests-2.32.3 urllib3-2.2.2
Ignore this: it was very similar error signature from the docker ansible module, upgrading community.docker fixed it.
I am using requests 2.32.3 and have the same issue! Is it fixed by now and is it released?
The fix is included in docker-py 7.1.0.
I faced the same problem.
requests version is 2.28.2. Ubuntu 22.04. Docker 27.1.2
Any solutions?
Thank you
ๆๆdocker็ๆฌๅ็บงๅฐๆๆฐ่งฃๅณไบ่ฟไธช้ฎ้ข
translated:
I upgraded the docker version to the latest version to solve this problem.
Version 7.1.0
ๆๆdocker็ๆฌๅ็บงๅฐๆๆฐ่งฃๅณไบ่ฟไธช้ฎ้ข
7.1.0็ๆฌ
I'm locking the conversation on this ticket, as this issue should be resolved by #3257, which is part of the 7.1.0 release; https://github.com/docker/docker-py/releases/tag/7.1.0

