Update name behaviour to match Docker CLI

Signed-off-by: Stuart Thomson <stuartwthomson@live.co.uk>
This commit is contained in:
Stuart Thomson 2020-08-29 22:45:22 +01:00
parent 290ee89a8c
commit 2bf5d56c73
1 changed files with 5 additions and 1 deletions

View File

@ -29,7 +29,11 @@ class Container(Model):
if self.attrs.get('Name') is not None:
return self.attrs['Name'].lstrip('/')
if self.attrs.get('Names') is not None:
return self.attrs['Names'][0].lstrip('/')
stripped_names = [name.lstrip('/') for name in self.attrs['Names']]
for name in stripped_names:
if '/' not in name:
return name
return ','.join(stripped_names)
@property
def image(self):