Class: Docker::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/support/docker_api.rb

Instance Method Summary collapse

Instance Method Details

#stats(options = {}) ⇒ Object

Non streaming stats



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/support/docker_api.rb', line 8

def stats(options = {})
  path = path_for(:stats)
  puts "Getting stats from: #{path}"
  options[:stream] = false
  container_stats = nil
  begin
    status = Timeout::timeout(5) {
      container_stats = connection.get(path, options)
    }
  rescue Exception => e
    return {error: e.message}
  end
  JSON.parse(container_stats)
end