Class: Docker::API::Volume

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

Overview

This class represents the Docker API endpoints regarding volumes.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#create(body = {}) ⇒ Object

Create a volume.

Docker API: POST /volumes/create

Parameters:

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

    : Request body to be sent as json.

See Also:



35
36
37
# File 'lib/docker/api/volume.rb', line 35

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

#details(name) ⇒ Object

Inspect a volume.

Docker API: GET /volumes/name

Parameters:

  • name (String)

    : The ID or name of the volume.

See Also:



24
25
26
# File 'lib/docker/api/volume.rb', line 24

def details name
    @connection.get("/volumes/#{name}")
end

#list(params = {}) ⇒ Object

List volumes.

Docker API: GET

Parameters:

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

    : Parameters that are appended to the URL.

See Also:



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

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

#prune(params = {}) ⇒ Object

Delete unused volumes.

Docker API: POST /volumes/prune

Parameters:

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

    : Parameters that are appended to the URL.

See Also:



58
59
60
# File 'lib/docker/api/volume.rb', line 58

def prune params = {}
    @connection.post(build_path("/volumes/prune", params))
end

#remove(name, params = {}) ⇒ Object

Remove a volume.

Docker API: DELETE /volumes/name

Parameters:

  • name (String)

    : The ID or name of the volume.

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

    : Parameters that are appended to the URL.

See Also:



47
48
49
# File 'lib/docker/api/volume.rb', line 47

def remove name, params = {}
    @connection.delete(build_path("/volumes/#{name}",params))
end