-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[BUG] Podman REST API return a list of containers with partial/missing "Mounts" attribute values #24878
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
Comments
This is calling into the podman ps api.
Not sure if that is correct, but this is the way it is coded. |
As opposed to the podman inspect api.
|
I guess that, unlike |
I just tested docker API by the container list call and docker API works well:
Output: ...
"Mounts": [
{
"Type": "bind",
"Source": "/home/athena/Exegol/exegol-resources",
"Destination": "/opt/resources",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/home/athena",
"Destination": "/workspaces",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
]
... I think podman container listing API should be fixed to show the same consistent information. |
I tend to agree with you. It looks like the Docker API does the correct thing and looks up the mounts on the server side. |
Should be a simple enough fix, but most of us are on PTO so I doubt it'll be touched until the new year. |
In terms of time effort, in your opinion how much time is it needed to work on the code to fix it? |
Probably a few hours? From what I can see, the results from |
The containers.list function is calling docker_containers = client.containers.list(all=True, filters={"name": "exegol-"}) Which is the same thing as |
I don't think this is a simple fix or the correct expectation that these types match. And as this payload is part of the stable API we cannot change it without breaking users so such API changes could only be done in a major version. If you want to get the docker like output you should call the docker compat API endpoints not the libpod one. |
So, it means that by podman API, the only Mount info we can get is only the "Destination"? It seems "poor". I think that adding as output on |
you can inspect the single container to get all the data. |
Mmh... Currently I am working on Exegol project to make Podman support, where the code lists all the containers by leveraging the mentioned API call by Podman Py libs. A workaround would be getting only the names of the collected containers and then getting data from each single container call. I agree that any changes on the API should be released for a major release, but my concern is just to start to work on it. I don't know where the related code to change and test is hosted, if on this repo or another open one. If you link me the related files, I can try to work on it. |
@mabulgu any news on this? PS: I think the touch could be also done but only for a major release. I think that this fix (because imho the described topic is an issue) is a "must have". The current values in "Mounts" are programmatically almost useless if not combined with the other values as produced by docker API. Why I say this: because the only info I get from API is the destination directory of mount, but I cannot get: the source it is associated, the type, the mode, the grants... So currently that Mount field is not effective. Sorry for my point. |
/unassign Unfortunately, I don't have the planned capacity to work on this anymore. @D3vil0p3r AFAIU you expect a quick solution but this is an OSS project and not everyone works on these as a part of their full-time job, that's why I said "Unless, of course, you have a tight deadline on those ..." to the maintainers while assigning the issue to myself.
Good point. I think you can also draft a PR with what you expect to have here and since this is sth you reported, probably you will be the most motivated person to resolve this:) Just an idea;) Good luck! |
Yes @mabulgu I would try to create a PR and work on it. Can I kindly ask you where I can find the source files/repositories related to this "Mount" part of the podman API? |
@D3vil0p3r I would start digging from here:
I'd notice the call for |
Thanks. By looking at the code, what I can say currently is that the issue is in
and podman/libpod/container_config.go Line 150 in 117fd69
so Its value is taken from: Line 263 in 117fd69
and Line 573 in 117fd69
I think that the solution to this issue should be an implementation as occurs for podman inspect, in container_inspect.go: podman/libpod/define/container_inspect.go Line 791 in 117fd69
where |
Just to be clear we cannot just change the API types, they must be stable. We could decide to break the API with 6.0. for this but there is not even a plan for a 6.0 yet so that would take a long time before we could accept a change. And IMO I am not sure the assumption is correct, container list and inspect return completely different types. Just changing one single Mounts filed is not going to solve that difference. There are a ton of other fields with different types as well. |
I agree about your point and I thank you for explaining your point. I am not saying that container list and inspection data must be the same, mostly if they deal with different data types. My point is only related to the "Mounts", that, currently, could not be effective, not only because its usage could be incomplete, for example, if I need an information about "Mounts" from container list API (1 call), and I need to retrieve info related to its source, if read-write, currently I am forced to do N inspect API calls, one for each container in the list. Another my personal reason is also that, by reading this output: "Mounts": [
"/opt/resources",
"/workspaces"
], how can be clear to the user if those paths correspond to "Destination" or "Source"? Yes, probably by reading docs if they detail this info, or just empirically, but I don't see this approach efficient. It is just my opinion as standard average user. |
I opened the following PR: #25697 Currently over 80 tests, only 5 tests are failing: sys podman debian-13 root host sqlite
sys podman debian-13 rootless host sqlite
sys podman fedora-41 root host sqlite
sys podman fedora-41 rootless host boltdb
sys podman rawhide root host sqlite
and
If you have some hint, please let me know. |
Issue Description
Podman REST API container list returns a list of containers with partial/missing Mounts attribute values.
Steps to reproduce the issue
Start podman daemon:
To simplify the reproduction, let's use Podman py:
Run this script. It will create a
exegol-default
container with differentmounts
elements.One note: when the container is created, the container attribute
mounts
has the right values. When the container is listed (so when the/containers/json
API is invoked), no.Then, enable API service:
and run:
It will return only
target
info ofmounts
, instead of other information:Describe the results you received
Describe the results you expected
I expect that Podman API return all the elements of
Mounts
, so not onlytarget
but alsosource
,type
and so on. I expect a result as occurs by docker API when running:By docker API the output is correct:
podman info output
Podman in a container
No
Privileged Or Rootless
Rootless
Upstream Latest Release
Yes
Additional environment details
Arch Linux
Additional information
Initial issue reported to containers/podman-py#488
The text was updated successfully, but these errors were encountered: