Skip to content
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

fix "dangling" filter and pruning #684

Merged
merged 3 commits into from
Jul 21, 2021

Conversation

vrothberg
Copy link
Member

A set of commits to fix containers/podman#10832:

  • Extend the dangling filter from "untagged image" to "untagged image without children" to match Docker.
  • Fix a bug in image removal where some removed images were not reported as such.
  • Extend the layer tree to also consider images with an empty top layer.

Podman PR: containers/podman#10983
Buildah PR: containers/buildah#3390

As discussed in github.com/containers/podman/issues/10832 the definition
of a "dangling" image in Podman has historically been incorrect.  While
the Docker docs describe a dangling image as an image without a tag, and
Podman implemented the filters as such, Docker actually implemented the
filters for images without a tag and without children.

Refine the dangling filters and hence `IsDangling()` to only return true
if an image is untagged and has no children.

Also correct the comments of `IsIntermediate()`.

Signed-off-by: Valentin Rothberg <[email protected]>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 20, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vrothberg

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Handle images without physical layers when constructing the layer tree
and store them in a dedicated slice that can later on be consulted when
computing parent/child relations.

Such "empty" images can be built with, for instance, with the following
Dockerfile:

```
FROM scratch
ENV test1=test1
ENV test2=test2
```

Signed-off-by: Valentin Rothberg <[email protected]>
Fix a bug where not all removed images were actually reported as such.
A regression test will be added to Podman.

Signed-off-by: Valentin Rothberg <[email protected]>
@vrothberg vrothberg changed the title WIP - fix "dangling" filter and pruning fix "dangling" filter and pruning Jul 20, 2021
@vrothberg
Copy link
Member Author

@containers/podman-maintainers PTAL

@rhatdan
Copy link
Member

rhatdan commented Jul 20, 2021

LGTM
@containers/podman-maintainers PTAL

@vrothberg
Copy link
Member Author

@Luap99 PTAL

@Luap99
Copy link
Member

Luap99 commented Jul 21, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Jul 21, 2021
@openshift-merge-robot openshift-merge-robot merged commit c95d2f7 into containers:main Jul 21, 2021
@vrothberg vrothberg deleted the dangling branch July 21, 2021 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermediate layers for tagged images are incorrectly pruned
4 participants