mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
image list: ignore bare manifest list
Handle empty/bare manifest lists when listing images. Fixes: #8931 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -44,8 +44,11 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions)
|
||||
}
|
||||
e.Labels, err = img.Labels(ctx)
|
||||
if err != nil {
|
||||
// Ignore empty manifest lists.
|
||||
if errors.Cause(err) != libpodImage.ErrImageIsBareList {
|
||||
return nil, errors.Wrapf(err, "error retrieving label for image %q: you may need to remove the image to resolve the error", img.ID())
|
||||
}
|
||||
}
|
||||
|
||||
ctnrs, err := img.Containers()
|
||||
if err != nil {
|
||||
|
@ -228,4 +228,17 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z
|
||||
run_podman rmi ${aaa_name}:${aaa_tag} ${zzz_name}:${zzz_tag}
|
||||
}
|
||||
|
||||
# Regression test for #8931
|
||||
@test "podman images - bare manifest list" {
|
||||
# Create an empty manifest list and list images.
|
||||
|
||||
run_podman inspect --format '{{.ID}}' $IMAGE
|
||||
iid=$output
|
||||
|
||||
run_podman manifest create test:1.0
|
||||
run_podman images --format '{{.ID}}' --no-trunc
|
||||
[[ "$output" == *"sha256:$iid"* ]]
|
||||
|
||||
run_podman rmi test:1.0
|
||||
}
|
||||
# vim: filetype=sh
|
||||
|
Reference in New Issue
Block a user