module Docklean::Images
Public Instance Methods
cleanup_images()
click to toggle source
# File lib/docklean/images.rb, line 28 def cleanup_images() # loop over all images, do not process duplicates, delete when not needed %x{#{@docker_bin} images -q --no-trunc=true}.split(/\n/).uniq.each do |image| if @images_to_keep.include?(image.chomp) then # do not delete this image else # safe to delete this image puts "info: deleting #{image.chomp} (image)" %x{#{@docker_bin} rmi #{image.chomp}} end end # cleanup dangling images (<none>) self.delete_dangling() end
delete_dangling()
click to toggle source
# File lib/docklean/images.rb, line 21 def delete_dangling() unless %x{#{@docker_bin} images -q -f dangling=true}.to_s.empty? then puts "info: deleting dangling images" %x{#{@docker_bin} rmi $(#{@docker_bin} images -q -f dangling=true)} end end