Volume
post/volumes/create

Request

  • Base URL
    /v1.57 (relative, and the document was published on a file host, not at the API’s origin)
  • Auth
    none declared

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"
  }
}

Changes

    • breaking

      removed the request body

    • breaking

      removed the success response with the status

    • info

      api tag Volume added

    • info

      added the non-success response with the status

    • info

      added the success response with the status

    • breaking

      removed the success response with the status

    • info

      api tag Volume removed

    • info

      the request property default value active was removed

    • info

      the request property default value local was removed

    • info

      the request property default value single was removed

    • info

      the request property default value none was removed

    • info

      removed the non-success response with the status

    • info

      added the success response with the status