Module: Dapp::Dimg::Dapp::Command::Cleanup

Included in:
Dapp
Defined in:
lib/dapp/dimg/dapp/command/cleanup.rb

Instance Method Summary collapse

Instance Method Details

#cleanupObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dapp/dimg/dapp/command/cleanup.rb', line 6

def cleanup
  lock("#{name}.images") do
    log_step_with_indent(name) do
      dapp_containers_flush
      dapp_dangling_images_flush
      remove_images_by_query([
        "#{host_docker} images",
        %(--format '{{if ne "#{stage_cache}" .Repository }}{{.Repository}}:{{.Tag}}{{ end }}'),
        %(-f "label=dapp=#{stage_dapp_label}")
      ].join(' ')) # FIXME: negative filter is not currently supported by the Docker CLI
    end
  end
end