We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 90bf689 commit bcb7c2bCopy full SHA for bcb7c2b
lib/kitchen/docker/helpers/image_helper.rb
@@ -41,7 +41,16 @@ def parse_image_id(output)
41
42
def remove_image(state)
43
image_id = state[:image_id]
44
- docker_command("rmi #{image_id}")
+ if image_in_use?(state)
45
+ info("[Docker] Image ID #{image_id} is in use. Skipping removal")
46
+ else
47
+ info("[Docker] Removing image with Image ID #{image_id}.")
48
+ docker_command("rmi #{image_id}")
49
+ end
50
51
+
52
+ def image_in_use?(state)
53
+ docker_command("ps -a", suppress_output: !logger.debug?).include?(state[:image_id])
54
end
55
56
def build_image(state, dockerfile)
0 commit comments