Class: Armada::Clean::Images
- Inherits:
-
Object
- Object
- Armada::Clean::Images
- Defined in:
- lib/armada/clean/images.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ Images
constructor
A new instance of Images.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ Images
Returns a new instance of Images.
4 5 6 7 8 9 |
# File 'lib/armada/clean/images.rb', line 4 def initialize() @hosts = [:hosts] @force = [:force] @noprune = ![:prune] @options = end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/armada/clean/images.rb', line 11 def run Armada.ui.info "******* DRY RUN *******" unless @force @hosts.each_in_parallel do |host| docker_host = Armada::Host.create(host, @options) docker_host.get_all_images.each do |image| if image.info["RepoTags"].include?("<none>:<none>") begin Armada.ui.info "#{docker_host.host} -- #{image.id[0..11]} is an abandoned image and will be removed" image.remove({:force => true, :noprune => @noprune}) if @force rescue Exception => e Armada.ui.error "#{docker_host.host} -- unable to remove image #{image.id[0..11]} because of the following error - #{e.}" end end end end end |