docker / docker-py

A Python library for the Docker Engine API

Home Page:https://docker-py.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create client fails with podman v5.0.1

planetmarshall opened this issue · comments

Summary

Can't create docker client using podman v5.0.1 socket

Steps to reproduce

Run the following script

import docker
import os
from subprocess import run

print(docker.__version__)
run([sys.executable, "--version"])
run(["podman", "--version" ])
print(os.getenv("DOCKER_HOST"))

client = docker.from_env()

I get the following output:

7.0.0
Python 3.12.2
podman version 5.0.1
unix:///run/user/1000/podman/podman.sock
Traceback (most recent call last):
  File "/home/andrew/projects/test-docker/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen
    response = self._make_request(
...
File "/home/andrew/projects/test-docker/venv/lib/python3.12/site-packages/docker/api/client.py", line 220, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

Reproduced on Arch Linux

My bad, I had not started the socket. See Socket Activation for anyone else experiencing this issue.