Skip to content

Commit

Permalink
Merge pull request #9 from DOO-DEV/fix-image-status
Browse files Browse the repository at this point in the history
fix: set the status of image
  • Loading branch information
arshamalh authored Dec 7, 2023
2 parents 14214e9 + 86d07cf commit 1b882d8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docker/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,18 @@ func (d *docker) ImageRemove(ctx context.Context, imageID string, force, pruneCh
func (d *docker) getImageStatus(ctx context.Context, image types.ImageSummary) (status string) {
if len(image.RepoTags) == 0 {
status = string(entities.ImageStatusUnUsedDangling)
return
}

if image.RepoTags[0] == "<none>:<none>" {
status = string(entities.ImageStatusUnUsedDangling)
return
}
containers, _ := d.cli.ContainerList(ctx, types.ContainerListOptions{})
if len(containers) == 0 {
status = string(entities.ImageStatusUnUsed)
return
}
newImgs := make(map[string][]string)
for _, cont := range containers {
if cont.ImageID != image.ID {
Expand Down

0 comments on commit 1b882d8

Please sign in to comment.