Replies: 1 comment
-
|
Hey. What are the features that you are missing? The issue you reported has a fix, for others, it would be nice to have these features tested and fixed.
At the end of the day, it's your call. I am pretty sure that docker does not test podman features. On the other side, we are partially compatible and tested (to some extent). Besides this, you would only get docker features that are implemented in podman i.e. you won't be able to use I'll explain more things in details now, but feel free to jump to conclusions as I tried to be comprehensive there too. For the purpose of this, I will use Fedora with Then, I verified that the commands work, but for the purpose of this I delete the symlink and created a temp sock to inspect the API calls in a log. $ sudo ls -l /var/run/docker.sock
lrwxrwxrwx. 1 root root 41 Oct 8 10:16 /var/run/docker.sock -> /tmp/podman.9HW3kQ9v25/podman/podman.sockNow, I will run everything as Let's start from your examples. 1a. $ sudo python -c 'import docker; print(docker.DockerClient().version())'
{'Platform': {'Name': 'linux/amd64/fedora-42'}, 'Components': [{'Name': 'Podman Engine', 'Version': '5.7.0-dev', 'Details': {'APIVersion': '5.7.0-dev', 'Arch': 'amd64', 'BuildTime': '2025-10-07T02:00:00+02:00', 'Experimental': 'false', 'GitCommit': '7fecff5c294412ab47ec7db62d8fa6af5ba0eeec', 'GoVersion': 'go1.24.7', 'KernelVersion': '6.16.10-200.fc42.x86_64', 'MinAPIVersion': '4.0.0', 'Os': 'linux'}}, {'Name': 'Conmon', 'Version': 'conmon version 2.1.13, commit: ', 'Details': {'Package': 'conmon-2.1.13-1.20250925133437522514.main.101.g80b5835.fc42.x86_64'}}, {'Name': 'OCI Runtime (crun)', 'Version': 'crun version UNKNOWN\ncommit: 040b16d394322350138ae6bd69f95c6c32f2d52c\nrundir: /run/user/0/crun\nspec: 1.0.0\n+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL', 'Details': {'Package': 'crun-1.24-1.20251001082447828962.main.13.gc9615b2f.fc42.x86_64'}}], 'Version': '5.7.0-dev', 'ApiVersion': '1.41', 'MinAPIVersion': '1.24', 'GitCommit': '7fecff5c294412ab47ec7db62d8fa6af5ba0eeec', 'GoVersion': 'go1.24.7', 'Os': 'linux', 'Arch': 'amd64', 'KernelVersion': '6.16.10-200.fc42.x86_64', 'BuildTime': '2025-10-07T02:00:00+02:00'}2a. $ sudo python -c 'import podman; print(podman.PodmanClient(base_url="unix:///tmp/podman.9HW3kQ9v25/podman/podman.sock").version())'
{'Platform': {'Name': 'linux/amd64/fedora-42'}, 'Components': [{'Name': 'Podman Engine', 'Version': '5.7.0-dev', 'Details': {'APIVersion': '5.7.0-dev', 'Arch': 'amd64', 'BuildTime': '2025-10-07T02:00:00+02:00', 'Experimental': 'false', 'GitCommit': '7fecff5c294412ab47ec7db62d8fa6af5ba0eeec', 'GoVersion': 'go1.24.7', 'KernelVersion': '6.16.10-200.fc42.x86_64', 'MinAPIVersion': '4.0.0', 'Os': 'linux'}}, {'Name': 'Conmon', 'Version': 'conmon version 2.1.13, commit: ', 'Details': {'Package': 'conmon-2.1.13-1.20250925133437522514.main.101.g80b5835.fc42.x86_64'}}, {'Name': 'OCI Runtime (crun)', 'Version': 'crun version UNKNOWN\ncommit: 040b16d394322350138ae6bd69f95c6c32f2d52c\nrundir: /run/user/0/crun\nspec: 1.0.0\n+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL', 'Details': {'Package': 'crun-1.24-1.20251001082447828962.main.13.gc9615b2f.fc42.x86_64'}}], 'Version': '5.7.0-dev', 'ApiVersion': '1.41', 'MinAPIVersion': '1.24', 'GitCommit': '7fecff5c294412ab47ec7db62d8fa6af5ba0eeec', 'GoVersion': 'go1.24.7', 'Os': 'linux', 'Arch': 'amd64', 'KernelVersion': '6.16.10-200.fc42.x86_64', 'BuildTime': '2025-10-07T02:00:00+02:00'}As you would imagine, these are the API calls. 1b. 2b. As you can see, you are doing very different requests. Let's see a different command Here I run a container with 1a. $ sudo python -c 'import docker; client = docker.from_env(); print(client.containers.list())'
[<Container: dbf0f7063c22>]2a. $ sudo python -c 'import podman; client = podman.PodmanClient(base_url="unix:///tmp/podman.9HW3kQ9v25/podman/podman.sock"); print(client.containers.list())'
[<Container: dbf0f7063c>]Still looks the same from python side, but the requests/responses are VERY different. 1b. 2b. Now let's try another command. I just want to list pods. 1a. $ sudo python -c 'import docker; client = docker.from_env(); print(client.pods.list())'
[sudo] password for nsella:
Traceback (most recent call last):
File "<string>", line 1, in <module>
import docker; client = docker.from_env(); print(client.pods.list())
^^^^^^^^^^^
File "/home/nsella/Documents/fork/docker/docker-py/docker/client.py", line 219, in __getattr__
raise AttributeError(' '.join(s))
AttributeError: 'DockerClient' object has no attribute 'pods'. Did you mean: 'nodes'?2b. $ sudo python -c 'import podman; client = podman.PodmanClient(base_url="unix:///tmp/podman.9HW3kQ9v25/podman/podman.sock"); print(client.pods.list())'
[]Whops. My conclusion. If your usecase is simple, podman or docker python library will work just fine, regardless of the combination. Listing containers will work, starting them, more or less, the same. I can tell that you'll be good as long as the features overlap. Also, you are not exposed to root/non-root because you have the VM in between, so that's something happening underneath that you don't see. If you were on a linux box you'd see that, and rootless would be my biggest selling point. The difference you can appreciate emerge once you take advantage of podman's unique features (like pod management) from docker's side they will simply fail. FTR, the same would apply if you call docker's features from podman's side. They will fail (like swarm, it will fail). What won't fail are podman to podman calls. This way you could use the libpod/compatible layer according to your needs. By default, you'll always get |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Sorry for a somewhat tactless question.
I could not make Podman Python library to work at all #595 and then to my surprise I have discovered that when I use the Docker Python library it actually works (successfully connects to the Podman API).
So, I now have this uncomfortable question: Can I just continue using Docker Python library with Podman? This would be easier for me - no extra dependencies, no need for logic that dynamically chooses which client to create, no need for other code duplication (I have a complex container launcher built on top of Docker: https://github.com/Cloud-Pipelines/backend/blob/e7837c0d2f77fdb60bff61049e0270c0cebbb56d/cloud_pipelines_backend/launchers/local_docker_launchers.py#L208).
So, realistically, what am I losing by using Docker client library + Podman? (I understand that it's unsupported configuration.)
Beta Was this translation helpful? Give feedback.
All reactions