Method: Docker::API::Container#stats

Defined in:
lib/docker/api/container.rb

#stats(name, params = {}, &block) ⇒ Object

Get container stats based on resource usage.

Docker API: GET /containers/id/stats

Parameters:

  • name (String)

    : The ID or name of the container.

  • params (Hash) (defaults to: {})

    : Parameters that are appended to the URL.

  • &block:

    Replace the default output to stdout behavior.

See Also:



246
247
248
249
250
251
252
253
254
# File 'lib/docker/api/container.rb', line 246

def stats name, params = {}, &block
    path = "/containers/#{name}/stats"

    if [true, 1 ].include? params[:stream]
        request(method: :get, path: path, params: params, response_block: block_given? ? block : default_streamer)
    else
        get(path, params)
    end
end