class Docker::API::Volume

This class represents the Docker API endpoints regarding volumes. @see docs.docker.com/engine/api/v1.40/#tag/Volume

Public Instance Methods

create(body = {}) click to toggle source

Create a volume.

Docker API: POST /volumes/create @see docs.docker.com/engine/api/v1.40/#operation/VolumeCreate

@param body [Hash]: Request body to be sent as json.

# 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) click to toggle source

Inspect a volume.

Docker API: GET /volumes/{name} @see docs.docker.com/engine/api/v1.40/#operation/VolumeInspect

@param name [String]: The ID or name of the volume.

# File lib/docker/api/volume.rb, line 24
def details name
    @connection.get("/volumes/#{name}")
end
list(params = {}) click to toggle source

List volumes.

Docker API: GET @see docs.docker.com/engine/api/v1.40/#operation/VolumeList

@param params [Hash]: Parameters that are appended to the URL.

# File lib/docker/api/volume.rb, line 13
def list params = {}
    @connection.get(build_path("/volumes", params))
end
prune(params = {}) click to toggle source

Delete unused volumes.

Docker API: POST /volumes/prune @see docs.docker.com/engine/api/v1.40/#operation/VolumePrune

@param params [Hash]: Parameters that are appended to the URL.

# File lib/docker/api/volume.rb, line 58
def prune params = {}
    @connection.post(build_path("/volumes/prune", params))
end
remove(name, params = {}) click to toggle source

Remove a volume.

Docker API: DELETE /volumes/{name} @see docs.docker.com/engine/api/v1.40/#operation/VolumeDelete

@param name [String]: The ID or name of the volume. @param params [Hash]: Parameters that are appended to the URL.

# File lib/docker/api/volume.rb, line 47
def remove name, params = {}
    @connection.delete(build_path("/volumes/#{name}",params))
end