Open Pilzington opened 4 years ago
We are concentrating more on podman-py, which should use the new API.
Are you running the script and the command as the same user (eg are you running podman images
as root)?
The podman client module requires root access (due to needing a unix socket binding), but each user has a unique list of images, containers, etc.
So if you run the command as your regular user, but the script as root, you'll get different output.
The reason that you are getting the output you have is because client.images.list() is a function and returns a generator, which has to be called to yield an actual value (that's why you're getting generator object), and because there are no images the for loops are printing nothing.
In order to print the images you'll need to iterate over the generator object (as you are doing with your for loop).
Hopefully this helps.
Are you running the script and the command as the same user (eg are you running
podman images
as root)?The podman client module requires root access (due to needing a unix socket binding), but each user has a unique list of images, containers, etc.
So if you run the command as your regular user, but the script as root, you'll get different output.
Ah thanks this was my problem.
The reason that you are getting the output you have is because client.images.list() is a function and returns a generator, which has to be called to yield an actual value (that's why you're getting generator object), and because there are no images the for loops are printing nothing.
In order to print the images you'll need to iterate over the generator object (as you are doing with your for loop).
Hopefully this helps.
I only printed these to show that the library seems to be working, if this makes sense.
Another question, if you don't mind: Is it possible to process all podman images/containers belonging to all users for an admin user?
Thank you very much for the help and support.
I installed podman and the python podman library. But I does not show any images or containers:
My Python Script:
Output:
Am I doing anything wrong? I installed it first following this blog post. Does this break anything due to the new API. Also is there a documentation anywhere?