python-podman icon indicating copy to clipboard operation
python-podman copied to clipboard

containers.list() gathers too much data

Open parmentelat opened this issue 6 years ago • 5 comments


I'm facing an issue with the simplest possible API call that I could think about

with podman.Client() as client: ...: list(client.containers.list())

which on my setup, with one single container running, takes in the 2 minutes


This issue was first opened in the plain podman repo https://github.com/containers/libpod/issues/4656

in that issue we have established that this mundane API call actually gathers information about disk space, which in this particular instance I do not need at all, but that slows things down terribly; the fact that 2 minutes are needed here is clearly a concern too, but should be taken separately


bottom line, I would like to know if there is currently a way to quickly obtain a simple list of containers, with minimal - even if quite incomplete - attached information;

parmentelat avatar Jan 09 '20 19:01 parmentelat

FYI here's how it's done in docker:

https://docker-py.readthedocs.io/en/stable/containers.html#docker.models.containers.ContainerCollection.list

where the list() method accepts a sparse parameter

IMHO having all calls to list() perform deep inspection of the subject containers makes it mostly unusable, do you not agree with that ?

parmentelat avatar Jan 10 '20 10:01 parmentelat

hi a few months back my understanding was there were plans to move to a new generation of the API, that would make this issue essentially obsolete

so just checking in, are there any updates that you guys would like to share ?

thank you

parmentelat avatar May 19 '20 14:05 parmentelat

The first versions are available in podman 1.9.2 and you can play with it there.

Python bindings should be being worked on in https://github.com/containers/podman-py. We would love to get contributors working on it.

rhatdan avatar May 19 '20 19:05 rhatdan

thanks for the update, great news indeed, will give it a try at the next opportunity !

parmentelat avatar May 20 '20 06:05 parmentelat

hi again
just to make sure I got it right; I just upgraded to Fedora 32, I can see version 1.9.1

# rpm -q podman
podman-1.9.1-1.fc32.x86_64

I take it version 1.9.2 is about to be published, right ?

also as far as the python wrapper, is there an rpm (preferred) or should I pip install from the git clone directly ?

thanks !

parmentelat avatar May 21 '20 09:05 parmentelat