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 images deletions fails when instances share the same image ID #360

Open
rshad opened this issue Feb 5, 2020 · 0 comments
Open

Docker images deletions fails when instances share the same image ID #360

rshad opened this issue Feb 5, 2020 · 0 comments

Comments

@rshad
Copy link

rshad commented Feb 5, 2020

Hi all!

Steps and Info. to reproduce the problem:

  • OS: Ubuntu 14.04

  • Clone master branch.

  • Enable Docker images deletion: remove_images: true

  • Create 2 instances. kitchen create

  • Delete them ktichen destroy

  • Note: Tested with instances of "AmazonLinux, Ubuntu 18,04 - 16.04 and Centos7"


I was working with the branch master and I faced 2 errors, which I describe on the following.

  • Error when creating instances

I first took the master branch, to solve the issue commented in #338, but I got an error when creating the container for each Kitchen instance, which was reported here #355 and solved here #356.

Message: Error getting internal IP of Docker container

So I then took the Fork branch of #356 and this resolved the error.


  • Error when deleting Docker images.

After setting remove_images: true I got the following error when deleting the docker images.

Error response from daemon: conflict: unable to delete xxxx (cannot be forced) - image is being used by running container xxxxx**

After some debugging, I found that when creating instances with the same provisioning commands, Kitchen use the same image for such instances. And when running kitchen destroy, Kitchen proceed by instance:image pairs. But in this case what we have of such pairs is: (2 instances case)

  • instance_1 : Image_0
  • instance_2: Image_0

So both instances' containers used the same image.

When deleting, the process flow is as follows:

  • Delete instance_1: ✔️

  • Delete Corresponding Docker Image "Image_0": ❌
    'image ID xx can't be deleted. still being used by a running container "instance_2'

  • Delete instance_2: ✔️

  • Delete Corresponding Docker Image "Image_0": ✔️

kr,

Rshad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant