Skip to content

Conversation

@ZaidMarwat
Copy link

@ZaidMarwat ZaidMarwat commented Dec 16, 2025

Fix ancestor filter to resolve image names to IDs. This is necessary since image names are mutable and can thus point to different image IDs as time goes by. The image ID, on the other hand, stays immutable and thus is the best approach in finding a container's ancestor.

Fixes: #27743

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?


Fixed `podman ps --filter ancestor=...` to resolve image names and tags to immutable image IDs at container creation time.

Previously, filtering by an image name or tag (e.g., `ancestor=alpine:latest`) could incorrectly match containers if the tag was later retagged to a different image. Podman now matches containers based on the original image ID they were created from, ensuring correct and Docker-compatible behavior when image tags are mutable.

…since image names are mutable and can thus point to different image IDs as time goes by. The image ID, on the other hand, stays immutable and thus is the best approach in finding a container's ancestor.

Fixes: containers#27743

Signed-off-by: Zaid Marwat <[email protected]>
@ZaidMarwat
Copy link
Author

Hi, this is my first contribution to Podman, so please bear with me as I’m still learning the project’s testing expectations.

I wanted to note that I ran make validatepr locally, but I am consistently hitting a Darwin (macOS) build failure. I verified that this does not appear to be related to my changes: I checked out a clean branch from main with no modifications and ran validatepr there as well, and it failed with the same Darwin build error. Based on that, I believe the failure is environmental or pre-existing rather than caused by this PR.

I am still working through the testing requirements and would appreciate any guidance on whether additional tests are expected beyond what I’ve added, or if there is a preferred way to validate this change.

Lastly, please let me know if you think this change warrants any documentation updates. I’m happy to add documentation if needed.

Thank you for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--ancestor refers to container's original image tag, rather than current

1 participant