v1

latestSwagger 2.02026-07-17107114423.2 KB
Volume

Create a volume

post/volumes/create

Request body

Namestring

The new volume's name. If not specified, Docker generates a name.

Driverstring

Name of the volume driver to use.

DriverOptsobject

A mapping of driver options and values. These options are passed directly to the driver and are driver specific.

Labelsobject

User-defined key/value metadata.

Example request

{
  "Name": "tardis",
  "Driver": "custom",
  "DriverOpts": {
    "device": "tmpfs",
    "o": "size=100m,uid=1000",
    "type": "tmpfs"
  },
  "Labels": {
    "com.example.some-label": "some-value",
    "com.example.some-other-label": "some-other-value"
  }
}

Response

The volume was created successfully

Namestring required

Name of the volume.

Driverstring required

Name of the volume driver used by the volume.

Mountpointstring required

Mount path of the volume on the host.

CreatedAtstring dateTime

Date/Time the volume was created.

Statusobject

Low-level details about the volume, provided by the volume driver. Details are returned as a map with key/value pairs: {"key":"value","key2":"value2"}.

The Status field is optional, and is omitted if the volume driver does not support this feature.

Labelsobject required

User-defined key/value metadata.

Scope'local' | 'global' required

The level at which the volume exists. Either global for cluster-wide, or local for machine level.

Optionsobject required

The driver specific options used when creating the volume.

Example response

{
  "Name": "tardis",
  "Driver": "custom",
  "Mountpoint": "/var/lib/docker/volumes/tardis",
  "CreatedAt": "2016-06-07T20:31:11.853781916Z",
  "Status": {
    "hello": "world"
  },
  "Labels": {
    "com.example.some-label": "some-value",
    "com.example.some-other-label": "some-other-value"
  },
  "Scope": "local",
  "ClusterVolume": {
    "Version": {
      "Index": 373531
    }
  },
  "Options": {
    "device": "tmpfs",
    "o": "size=100m,uid=1000",
    "type": "tmpfs"
  }
}