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

Always run untag when removing docker image #70647

Merged
merged 3 commits into from Feb 26, 2019

Conversation

@corvus-ch
Copy link
Contributor

corvus-ch commented Nov 5, 2018

What type of PR is this?
/kind bug

What this PR does / why we need it:

Under certain conditions a docker image can have one tag while
assiciated to multiple repositories. This prevents the image from being
removed due to the multi repository association. Always removing all
tags, prevents this from happening.

This can be reproduced with the following:

docker pull centos:7
docker tag centos:7 example.com:1234/centos:latest
docker push example.com:1234/centos:latest
docker rmi example.com:1234/centos:latest
docker pull example.com:1234/centos:latest

This ends with an image which has one image tag but multiple repo digests.

docker image inspect centos:7 | jq '.[0] | .RepoTags, .RepoDigests'
[
  "centos:latest"
]
[
  "centos@sha256:67dad89757a55bfdfabec8abd0e22f8c7c12a1856514726470228063ed86593b",
  "example.com:1234/centos@sha256:67dad89757a55bfdfabec8abd0e22f8c7c12a1856514726470228063ed86593b"
]

Which issue(s) this PR fixes
none

Special notes for your reviewer:
none

Does this PR introduce a user-facing change?:

Image garbage collection no longer fails for images with only one tag but more than one repository associated.

@corvus-ch corvus-ch changed the title Always run untag when removing docker image [WIP] Always run untag when removing docker image Nov 6, 2018

@corvus-ch corvus-ch force-pushed the vshn:imagegc_multi_repo_image_removal branch from aa84567 to 1d8e461 Nov 6, 2018

@k8s-ci-robot k8s-ci-robot added size/L and removed size/XS labels Nov 6, 2018

@corvus-ch corvus-ch changed the title [WIP] Always run untag when removing docker image Always run untag when removing docker image Nov 6, 2018

@corvus-ch corvus-ch force-pushed the vshn:imagegc_multi_repo_image_removal branch from 1d8e461 to 9e8df0f Nov 6, 2018

@sjenning

This comment has been minimized.

Copy link
Contributor

sjenning commented Nov 7, 2018

/ok-to-test

@corvus-ch

This comment has been minimized.

Copy link
Contributor Author

corvus-ch commented Dec 4, 2018

Is there some action required on my side for this to proceed? If this is the case, please let me known and I will take care of it.

@mhutter

This comment has been minimized.

Copy link

mhutter commented Dec 17, 2018

@sjenning is there something more required before this can be merged and backported?

@sjenning

This comment has been minimized.

Copy link
Contributor

sjenning commented Dec 17, 2018

needs lgtm and approval. I can only lgtm. This makes sense to me.
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm label Dec 17, 2018

@sjenning

This comment has been minimized.

Copy link
Contributor

sjenning commented Dec 17, 2018

/assign @derekwaynecarr @yujuhong
for review/approval

@derekwaynecarr

This comment has been minimized.

Copy link
Member

derekwaynecarr commented Feb 26, 2019

this makes sense to me as well.

/approve

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Feb 26, 2019

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: corvus-ch, derekwaynecarr

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit cf24d24 into kubernetes:master Feb 26, 2019

18 checks passed

cla/linuxfoundation corvus-ch authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-cross Skipped
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gke Skipped
pull-kubernetes-e2e-kops-aws Context retired without replacement.
pull-kubernetes-e2e-kubeadm-gce Skipped
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped
pull-kubernetes-local-e2e-containerized Context retired without replacement.
Details
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
tide In merge pool.
Details

@corvus-ch corvus-ch deleted the vshn:imagegc_multi_repo_image_removal branch Feb 27, 2019


for _, image := range images {
if _, err := ds.client.RemoveImage(image, dockertypes.ImageRemoveOptions{PruneChildren: true}); err != nil && !libdocker.IsImageNotFoundError(err) {
return nil, err

This comment has been minimized.

@redbaron

redbaron Feb 28, 2019

Contributor

wouldn't it start returning image not found error after all tags are deleted?

@redbaron

This comment has been minimized.

Copy link
Contributor

redbaron commented Feb 28, 2019

@corvus-ch , which problem does it solve? comment suggests that repo digests are preventing image from being deleted, but in my testing digests do not create any references, tags do and deleting all tags is enough to delete image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.