Class: Docker::API::System

Inherits:
Base
  • Object
show all
Defined in:
lib/docker/api/system.rb

Overview

This class represents the Docker API system related endpoints.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Docker::API::Base

Instance Method Details

#auth(body = {}) ⇒ Object

Validate credentials for a registry and, if available, get an identity token for accessing the registry without password.

Docker API: POST /auth

Parameters:

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

    : Request body to be sent as json.

See Also:



13
14
15
# File 'lib/docker/api/system.rb', line 13

def auth body = {}
    @connection.request(method: :post, path: "/auth", headers: { "Content-Type" => "application/json" }, body: body.to_json)
end

#df(params = {}) ⇒ Object

Get data usage information.

Docker API: GET /system/df



61
62
63
# File 'lib/docker/api/system.rb', line 61

def df params = {}
    @connection.get(build_path("/system/df", params))
end

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

Stream real-time events from the server.

Docker API: GET /events

Parameters:

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

    : Parameters that are appended to the URL.

  • &block:

    Replace the default output to stdout behavior.

See Also:



25
26
27
# File 'lib/docker/api/system.rb', line 25

def events params = {}, &block
    @connection.request(method: :get, path: build_path("/events", params), response_block: block_given? ? block : default_streamer )
end

#infoObject

Get system information.

Docker API: GET /info



43
44
45
# File 'lib/docker/api/system.rb', line 43

def info
    @connection.get("/info")
end

#pingObject

This is a dummy endpoint you can use to test if the server is accessible.

Docker API: GET /_ping



34
35
36
# File 'lib/docker/api/system.rb', line 34

def ping
    @connection.get("/_ping")
end

#versionObject

Return the version of Docker that is running and various information about the system that Docker is running on.

Docker API: GET /version



52
53
54
# File 'lib/docker/api/system.rb', line 52

def version
    @connection.get("/version")
end