class documentation

class VolumeCollection(Collection): (source)

View In Hierarchy

Volumes on the Docker server.

Method create Create a volume.
Method get Get a volume.
Method list List volumes. Similar to the ``docker volume ls`` command.
Method prune Undocumented

Inherited from Collection:

Method __call__ Undocumented
Method __init__ Undocumented
Method prepare_model Create a model from a set of attributes.
Class Variable model Undocumented
Instance Variable client Undocumented
def create(self, name=None, **kwargs): (source)

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: (:py:class:`Volume`): The volume created. Raises: :py:class:`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"})

def get(self, volume_id): (source)

Get a volume. Args: volume_id (str): Volume name. Returns: (:py:class:`Volume`): The volume. Raises: :py:class:`docker.errors.NotFound` If the volume does not exist. :py:class:`docker.errors.APIError` If the server returns an error.

def list(self, **kwargs): (source)

List volumes. Similar to the ``docker volume ls`` command. Args: filters (dict): Server-side list filtering options. Returns: (list of :py:class:`Volume`): The volumes. Raises: :py:class:`docker.errors.APIError` If the server returns an error.

def prune(self, filters=None): (source)

Undocumented