Skip to content

Commit

Permalink
delete tags before deleting image IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed May 21, 2019
1 parent c93cad9 commit 2a0795e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions agent/engine/docker_image_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,15 @@ func (imageManager *dockerImageManager) removeNonECSImages(ctx context.Context,
if numImagesAlreadyDeleted == nonECSImagesNumToDelete {
break
}
if len(image.RepoTags) > 1 {
seelog.Debugf("Non-ECS image has more than one tag Image: %s (Tags: %s)", image.ImageID, image.RepoTags)
for _, tag := range image.RepoTags {
err := imageManager.client.RemoveImage(ctx, tag, dockerclient.RemoveImageTimeout)
if err != nil {
seelog.Errorf("Error removing RepoTag (ImageID: %s, Tag: %s) %v", image.ImageID, tag, err)
}
}
}
seelog.Debugf("Removing non-ECS Image: %s (Tags: %s)", image.ImageID, image.RepoTags)
err := imageManager.client.RemoveImage(ctx, image.ImageID, dockerclient.RemoveImageTimeout)
if err != nil {
Expand Down

0 comments on commit 2a0795e

Please sign in to comment.