Skip to content

Latest commit

 

History

History
241 lines (163 loc) · 6.84 KB

VolumeApi.md

File metadata and controls

241 lines (163 loc) · 6.84 KB

DockerEngineApi.VolumeApi

All URIs are relative to http://localhost/v1.41

Method HTTP request Description
volumeCreate POST /volumes/create Create a volume
volumeDelete DELETE /volumes/{name} Remove a volume
volumeInspect GET /volumes/{name} Inspect a volume
volumeList GET /volumes List volumes
volumePrune POST /volumes/prune Delete unused volumes

volumeCreate

Volume volumeCreate(volumeConfig)

Create a volume

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.VolumeApi();

var volumeConfig = new DockerEngineApi.VolumeConfig(); // VolumeConfig | Volume configuration


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.volumeCreate(volumeConfig, callback);

Parameters

Name Type Description Notes
volumeConfig VolumeConfig Volume configuration

Return type

Volume

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

volumeDelete

volumeDelete(name, opts)

Remove a volume

Instruct the driver to remove the volume.

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.VolumeApi();

var name = "name_example"; // String | Volume name or ID

var opts = { 
  'force': false // Boolean | Force the removal of the volume
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.volumeDelete(name, opts, callback);

Parameters

Name Type Description Notes
name String Volume name or ID
force Boolean Force the removal of the volume [optional] [default to false]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json, text/plain

volumeInspect

Volume volumeInspect(name)

Inspect a volume

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.VolumeApi();

var name = "name_example"; // String | Volume name or ID


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.volumeInspect(name, callback);

Parameters

Name Type Description Notes
name String Volume name or ID

Return type

Volume

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json

volumeList

VolumeListResponse volumeList(opts)

List volumes

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.VolumeApi();

var opts = { 
  'filters': "filters_example" // String | JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. Available filters:  - `dangling=<boolean>` When set to `true` (or `1`), returns all    volumes that are not in use by a container. When set to `false`    (or `0`), only volumes that are in use by one or more    containers are returned. - `driver=<volume-driver-name>` Matches volumes based on their driver. - `label=<key>` or `label=<key>:<value>` Matches volumes based on    the presence of a `label` alone or a `label` and a value. - `name=<volume-name>` Matches all or part of a volume name. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.volumeList(opts, callback);

Parameters

Name Type Description Notes
filters String JSON encoded value of the filters (a map[string][]string) to process on the volumes list. Available filters: - dangling=<boolean> When set to true (or 1), returns all volumes that are not in use by a container. When set to false (or 0), only volumes that are in use by one or more containers are returned. - driver=<volume-driver-name> Matches volumes based on their driver. - label=<key> or label=<key>:<value> Matches volumes based on the presence of a label alone or a label and a value. - name=<volume-name> Matches all or part of a volume name. [optional]

Return type

VolumeListResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json

volumePrune

VolumePruneResponse volumePrune(opts)

Delete unused volumes

Example

var DockerEngineApi = require('docker_engine_api');

var apiInstance = new DockerEngineApi.VolumeApi();

var opts = { 
  'filters': "filters_example" // String | Filters to process on the prune list, encoded as JSON (a `map[string][]string`).  Available filters: - `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune volumes with (or without, in case `label!=...` is used) the specified labels. 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.volumePrune(opts, callback);

Parameters

Name Type Description Notes
filters String Filters to process on the prune list, encoded as JSON (a map[string][]string). Available filters: - label (label=<key>, label=<key>=<value>, label!=<key>, or label!=<key>=<value>) Prune volumes with (or without, in case label!=... is used) the specified labels. [optional]

Return type

VolumePruneResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json, text/plain
  • Accept: application/json