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

unix:// client URL fails #3303

Closed
AstraLuma opened this issue Dec 12, 2024 · 3 comments
Closed

unix:// client URL fails #3303

AstraLuma opened this issue Dec 12, 2024 · 3 comments

Comments

@AstraLuma
Copy link

Doing #3146 (comment) , and I'm now getting errors like:

  File "/home/astraluma/code/unholy/unholy/docker.py", line 48, in get_client
    return docker.DockerClient(
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/unholy/lib/python3.12/site-packages/docker/client.py", line 45, in __init__
    self.api = APIClient(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/unholy/lib/python3.12/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/unholy/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

The initial root looks like:

if base_url.startswith('http+unix://'):

where it looks for http+unix:// but not unix://.

But if I munge the URL to be http+unix:// instead, I get:

Traceback (most recent call last):
  File "/home/astraluma/.local/pipx/venvs/unholy/lib/python3.12/site-packages/requests/adapters.py", line 633, in send
    conn = self.get_connection_with_tls_context(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/unholy/lib/python3.12/site-packages/requests/adapters.py", line 489, in get_connection_with_tls_context
    conn = self.poolmanager.connection_from_host(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/unholy/lib/python3.12/site-packages/urllib3/poolmanager.py", line 303, in connection_from_host
    return self.connection_from_context(request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/astraluma/.local/pipx/venvs/unholy/lib/python3.12/site-packages/urllib3/poolmanager.py", line 325, in connection_from_context
    raise URLSchemeUnknown(scheme)
urllib3.exceptions.URLSchemeUnknown: Not supported URL scheme http+docker

Note that the Docker CLI is fine with unix://.

@AstraLuma
Copy link
Author

AstraLuma commented Dec 12, 2024

$ docker context ls
NAME        DESCRIPTION                               DOCKER ENDPOINT                            ERROR
default *   Current DOCKER_HOST based configuration   unix:///run/user/1000/podman/podman.sock   
docker      system docker                             unix:///var/run/docker.sock                
podman      user podman                               unix:///run/user/1000/podman/podman.sock   
Warning: DOCKER_HOST environment variable overrides the active context. To use a context, either set the global --context flag, or unset DOCKER_HOST environment variable.
$ docker -c podman version
Client: Docker Engine - Community
 Version:           27.4.0
 API version:       1.41 (downgraded from 1.47)
 Go version:        go1.22.10
 Git commit:        bde2b89
 Built:             Sat Dec  7 10:39:01 2024
 OS/Arch:           linux/amd64
 Context:           podman

Server: linux/amd64/debian-unknown
 Podman Engine:
  Version:          5.3.1
  APIVersion:       5.3.1
  Arch:             amd64
  BuildTime:        2024-12-06T08:13:07-05:00
  Experimental:     false
  GitCommit:        
  GoVersion:        go1.23.4
  KernelVersion:    6.11.9-amd64
  MinAPIVersion:    4.0.0
  Os:               linux
 Conmon:
  Version:          conmon version 2.1.12, commit: unknown
  Package:          conmon_2.1.12-3_amd64
 OCI Runtime (crun):
  Version:          crun version 1.18.2
commit: 00ab38af875ddd0d1a8226addda52e1de18339b5
rundir: /run/user/1000/crun
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +WASM:wasmedge +YAJL
  Package:          crun_1.18.2-1_amd64
 Engine:
  Version:          5.3.1
  API version:      1.41 (minimum version 1.24)
  Go version:       go1.23.4
  Git commit:       
  Built:            Fri Dec  6 08:13:07 2024
  OS/Arch:          linux/amd64
  Experimental:     false
$ docker -c docker version
Client: Docker Engine - Community
 Version:           27.4.0
 API version:       1.47
 Go version:        go1.22.10
 Git commit:        bde2b89
 Built:             Sat Dec  7 10:39:01 2024
 OS/Arch:           linux/amd64
 Context:           docker

Server: Docker Engine - Community
 Engine:
  Version:          27.4.0
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.10
  Git commit:       92a8393
  Built:            Sat Dec  7 10:39:01 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.7.24
  GitCommit:        88bf19b2105c8b17560993bee28a01ddc2f97182
 runc:
  Version:          1.2.2
  GitCommit:        v1.2.2-0-g7cb3632
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

@felixfontein
Copy link
Contributor

Searching for that error message in this repo gives you #3256.

Using a newer version of Docker SDK for Python or a newer or older version of Python requests should fix the problem.

@AstraLuma
Copy link
Author

Yeah, looks fixed.

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

2 participants