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

bugfix: removing image by ID should conflict with running container. #2927

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

zjumoon01
Copy link
Contributor

@zjumoon01 zjumoon01 commented Jun 24, 2019

If image is used by a running container and this image has another tag,
there are two reference of this image. Remove the image by ID without
"--force" will success that is unexpected.

This patch will fix it. We should check if any containers using this
image ID. And add tests.

Signed-off-by: Wang Rui baijia.wr@antfin.com

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

Ⅳ. Describe how to verify it

step 1. Pull image registry.hub.docker.com/library/busybox:1.28
step 2. Tag this image to registry.hub.docker.com/library/busybox:tag2
step 3. Run a container with this image
step 4. Pouch rmi without "--force", the image will removed unexpected.
With this patch, it won't be successful in Step 4.

Ⅴ. Special notes for reviews

If image is used by a running container and this image has another tag,
there are two reference of this image. Remove the image by ID without
"--force" will success that is unexpected.

This patch will fix it. We should check if any containers using this
image ID. And add tests.

Signed-off-by: Wang Rui <baijia.wr@antfin.com>
@codecov
Copy link

codecov bot commented Jun 24, 2019

Codecov Report

Merging #2927 into master will increase coverage by 1.49%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2927      +/-   ##
==========================================
+ Coverage   66.78%   68.28%   +1.49%     
==========================================
  Files         289      291       +2     
  Lines       18299    18334      +35     
==========================================
+ Hits        12221    12519     +298     
+ Misses       4645     4358     -287     
- Partials     1433     1457      +24
Flag Coverage Δ
#criv1alpha2_test 34.83% <0%> (?)
#integration_test_0 36.15% <20%> (+0.05%) ⬆️
#integration_test_1 35.05% <60%> (-0.45%) ⬇️
#integration_test_2 36.37% <100%> (+0.33%) ⬆️
#integration_test_3 35.55% <60%> (-0.06%) ⬇️
#node_e2e_test 34.22% <0%> (ø) ⬆️
#unittest 27.98% <0%> (-0.01%) ⬇️
Impacted Files Coverage Δ
apis/server/image_bridge.go 79.1% <100%> (+0.64%) ⬆️
apis/server/utils.go 71.15% <0%> (-3.85%) ⬇️
daemon/mgr/spec_apparmor_linux.go 20% <0%> (ø)
daemon/mgr/spec_seccomp_linux.go 71.42% <0%> (ø)
daemon/mgr/container_types.go 71.32% <0%> (+1.47%) ⬆️
daemon/containerio/io.go 72.81% <0%> (+1.94%) ⬆️
cri/v1alpha2/cri_utils.go 89.57% <0%> (+2.7%) ⬆️
daemon/mgr/spec_linux.go 79.37% <0%> (+2.79%) ⬆️
daemon/mgr/container_state.go 96.66% <0%> (+3.33%) ⬆️
cri/v1alpha2/cri.go 64.28% <0%> (+3.75%) ⬆️
... and 10 more

@pouchrobot pouchrobot added kind/bug This is bug report for project size/M labels Jun 24, 2019
Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This is bug report for project size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants