Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions docker/models/volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ def name(self):
"""The name of the volume."""
return self.attrs['Name']

@property
def labels(self):
"""
The labels of a volume as dictionary.
"""
try:
result = self.attrs['Config'].get('Labels')
return result or {}
except KeyError as ke:
raise DockerException(
'Label data is not available for sparse objects. Call reload()'
' to retrieve all information'
) from ke

def remove(self, force=False):
"""
Remove this volume.
Expand Down