This commit is contained in:
Filip "Ret2Me" Poplewski 2025-04-18 15:50:54 +00:00 committed by GitHub
commit 405bb5c87f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -11,6 +11,20 @@ class Volume(Model):
"""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.