File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,21 @@ def create_image(version)
1515
1616 def delete_image
1717 puts "Deleting image..."
18+ puts "Image ID to delete: #{ @image . id } "
19+
1820 # Stop and remove only containers created from this image
1921 Docker ::Container . all ( :all => true ) . each do |container |
20- image_id = container . info [ 'Image' ]
22+ container_image = container . info [ 'Image' ]
23+ container_image_id = container . info [ 'ImageID' ]
24+
25+ puts "Container #{ container . id [ 0 ..11 ] } : Image=#{ container_image } , ImageID=#{ container_image_id } "
26+
2127 # Match both short and long image IDs
22- if image_id == @image . id || image_id == @image . id [ 0 ..11 ] || container . info [ 'ImageID' ] == @image . id
28+ if container_image == @image . id ||
29+ container_image == @image . id [ 0 ..11 ] ||
30+ container_image_id == @image . id ||
31+ container_image_id == @image . id [ 0 ..11 ]
32+ puts " -> Matches! Removing container #{ container . id [ 0 ..11 ] } "
2333 begin
2434 container . stop unless container . info [ 'State' ] == 'exited'
2535 container . delete ( :force => true )
You can’t perform that action at this time.
0 commit comments