models.volumes

Module Contents

Classes

Volume() A volume.
VolumeCollection() Volumes on the Docker server.
class Volume

A volume.

name()

The name of the volume.

remove(force=False)

Remove this volume.

Args:
force (bool): Force removal of volumes that were already removed
out of band by the volume driver plugin.
Raises:
docker.errors.APIError
If volume failed to remove.
class VolumeCollection

Volumes on the Docker server.

create(name=None, **kwargs)

Create a volume.

Args:
name (str): Name of the volume. If not specified, the engine
generates a name.

driver (str): Name of the driver used to create the volume driver_opts (dict): Driver options as a key-value dictionary labels (dict): Labels to set on the volume

Returns:
(Volume): The volume created.
Raises:
docker.errors.APIError
If the server returns an error.

Example:

>>> volume = client.volumes.create(name='foobar', driver='local',
        driver_opts={'foo': 'bar', 'baz': 'false'},
        labels={"key": "value"})
get(volume_id)

Get a volume.

Args:
volume_id (str): Volume name.
Returns:
(Volume): The volume.
Raises:
docker.errors.NotFound
If the volume does not exist.
docker.errors.APIError
If the server returns an error.
list(**kwargs)

List volumes. Similar to the docker volume ls command.

Args:
filters (dict): Server-side list filtering options.
Returns:
(list of Volume): The volumes.
Raises:
docker.errors.APIError
If the server returns an error.
prune(filters=None)