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

image manager: cleanup 'dead' and 'created' containers #2015

Merged
merged 1 commit into from
May 3, 2019

Conversation

sparrc
Copy link
Contributor

@sparrc sparrc commented May 2, 2019

also cleanup of 'dangling' images that have no tags or names associated
with them (ie, they show as in 'docker images')

see #1684

Summary

Implementation details

Testing

New tests cover the changes:

Description for the changelog

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sparrc sparrc changed the title image manager: cleanup 'dead' and 'created' containers [WIP] image manager: cleanup 'dead' and 'created' containers May 2, 2019
@sparrc sparrc added the bot/test label May 2, 2019
@sparrc sparrc changed the title [WIP] image manager: cleanup 'dead' and 'created' containers image manager: cleanup 'dead' and 'created' containers May 2, 2019
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
agent/engine/docker_image_manager.go Outdated Show resolved Hide resolved
seelog.Errorf("Error inspecting non-ECS image name: %s - %v", imageName, iiErr)
// Get the all image sizes
for _, image := range nonECSImagesRmEligible {
resp, err := imageManager.client.InspectImage(image.ImageID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why this was change from imageName to imageID?
Sometimes, two images can have same ID but different names. just making sure this doesn't break anything.

Copy link
Contributor Author

@sparrc sparrc May 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I changed this to image ID is because with image name we don't properly cleanup 'dangling' images (because the name is <none>). I made a comment about this here: #1684 (comment)

But that is a good catch, I did not realize two images can have the same ID but a different name. Maybe changing this behavior should be broken out into a separate issue and PR, if we want to do it at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, I've removed the parts that removed 'dangling images'

@sparrc sparrc force-pushed the sparrc-1684 branch 3 times, most recently from 788ab3a to 8372fef Compare May 3, 2019 18:13
also cleanup of 'dangling' images that have no tags or names associated
with them (ie, they show as <none> in 'docker images')

closes aws#1684

unit tests

dont touch dangling images -- for now

skip containers that don't have a finished time
Copy link
Contributor

@sharanyad sharanyad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests could be made table-driven in a future refactor.

Copy link
Member

@fierlion fierlion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. nice to see these thorough tests.

@sparrc sparrc merged commit 9fb3226 into aws:dev May 3, 2019
@sparrc sparrc deleted the sparrc-1684 branch May 3, 2019 23:52
@sparrc sparrc added this to the 1.28.0 milestone May 8, 2019
@fenxiong fenxiong mentioned this pull request May 9, 2019
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.

4 participants