Error while fetching server API version: Not supported URL scheme http+docker

Hello,
I have a problem with update my running container
Everything works fine but now I got this error, maybe someone fixed it already?

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/adapters.py",                                                                                                                                                              line 555, in send
    conn = self.get_connection_with_tls_context(
  File "/home/ubuntu/.local/lib/python3.10/site-packages/requests/adapters.py",                                                                                                                                                              line 411, in get_connection_with_tls_context
    conn = self.poolmanager.connection_from_host(
  File "/usr/local/lib/python3.10/dist-packages/urllib3/poolmanager.py", line 30                                                                                                                                                             4, in connection_from_host
    return self.connection_from_context(request_context)
  File "/usr/local/lib/python3.10/dist-packages/urllib3/poolmanager.py", line 32                                                                                                                                                             6, 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 _retr                                                                                                                                                             ieve_server_version
    return self.version(api_version=False)["ApiVersion"]
  File "/usr/lib/python3/dist-packages/docker/api/daemon.py", line 181, in versi                                                                                                                                                             on
    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 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 "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'dock                                                                                                                                                             er-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 perfor                                                                                                                                                             m_command
    project = project_from_options('.', options)
  File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 60, in proj                                                                                                                                                             ect_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, i                                                                                                                                                             n 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 __ini                                                                                                                                                             t__
    self._version = self._retrieve_server_version()
  File "/usr/lib/python3/dist-packages/docker/api/client.py", line 221, in _retr                                                                                                                                                             ieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: Not supp                                                                                                                                                             orted URL scheme http+docker

What is ā€œan updated containerā€? All I see a python error saying you have invalid configuration.

docker.errors.DockerException: Error while fetching server API version: Not supported URL scheme http+docker

i got this error while trying to execute docker-compose up -d on my ubuntu server.
Everything was fine, I got my container running, but I need to make an update and this error came in.
I saw that others also face this issue and said that it is caused by requests lib but i put there older version of it and it does not help at all

Stop using the docker-compose command. In some cases that is an alias to docker compose but it was originally Docker Compose v1 which is not maintained anymore and wil not support newer Docker API versions. Run

docker compose up -d
1 Like

Moving forward is likely a good idea. But for reference there was recently an issue with docker-py and compatibility with the recent update of python requests:

1 Like