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

docker: set force=true on remove image to handle images referenced by multiple tags #15962

Merged
merged 2 commits into from
Jan 31, 2023

Conversation

shoenig
Copy link
Member

@shoenig shoenig commented Jan 30, 2023

This PR changes our call of docker client RemoveImage() to RemoveImageExtended with
the Force=true option set. This fixes a bug where an image referenced by more than
one tag could never be garbage collected by Nomad. The Force option only applies to
stopped containers; it does not affect running workloads.

Fixes #15760

… multiple tags

This PR changes our call of docker client RemoveImage() to RemoveImageExtended with
the Force=true option set. This fixes a bug where an image referenced by more than
one tag could never be garbage collected by Nomad. The Force option only applies to
stopped containers; it does not affect running workloads.
@shoenig shoenig marked this pull request as ready for review January 30, 2023 18:59
@shoenig shoenig added backport/1.2.x backport to 1.1.x release line backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line labels Jan 30, 2023
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM

Looking at the dockerCoordinator code, I suspect this will subvert the image_delay when folks have multiple tags on the same image if ref counts for those tags all go to zero within the delay window. But I also think if you care a lot about image_delay then you are going to care about canonicalizing which image tag you're using?

Copy link
Member

@jrasell jrasell left a comment

Choose a reason for hiding this comment

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

LGTM!

@shoenig
Copy link
Member Author

shoenig commented Jan 31, 2023

I suspect this will subvert the image_delay

Indeed, this swaps one bug for another, but I think for the less bad one.

With this change there's potential for missed optimization in re-using a downloaded image. Without, images can pile up on a node and require external maintenence as described in #15760. I added a note to the image_delay docs noting the caveat with referencing an image by multiple tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.2.x backport to 1.1.x release line backport/1.3.x backport to 1.3.x release line backport/1.4.x backport to 1.4.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unable to delete docker image with multiple tags on same id
3 participants