class Dockit::Volume

Attributes

volume[R]

Public Class Methods

clean() click to toggle source

can't remove non-dangling containers, so don't bother with “force” argument

# File lib/dockit/volume.rb, line 12
def clean
  puts "Volumes..."
  (list(dangling: true)||[]).each do |volume|
    name = volume['Name']
    puts "  #{name}"
    delete(name)
  end
end
delete(name) click to toggle source
# File lib/dockit/volume.rb, line 21
def delete(name)
  Docker.connection.delete("/volumes/#{name}")
end
list(dangling: false) click to toggle source
# File lib/dockit/volume.rb, line 6
def list(dangling: false)
  fetch(dangling: dangling)
end

Private Class Methods

fetch(path='', dangling: false) click to toggle source
# File lib/dockit/volume.rb, line 27
def fetch(path='', dangling: false)
  Docker::Util.parse_json(
    Docker.connection.get(
    "/volumes#{path}", filters: JSON.dump({dangling: [dangling.to_s]}))
  )['Volumes']
end