From a2ec572fdf45655d5805df0abb0a84e76e6f8bf3 Mon Sep 17 00:00:00 2001 From: Boris HUISGEN Date: Sun, 6 May 2018 12:26:37 +0200 Subject: [PATCH] Use same tag as service definition Signed-off-by: Boris HUISGEN --- compose/cli/main.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/compose/cli/main.py b/compose/cli/main.py index e0acf0711..69d6ca4dd 100644 --- a/compose/cli/main.py +++ b/compose/cli/main.py @@ -579,10 +579,18 @@ class TopLevelCommand(object): rows = [] for container in containers: image_config = container.image_config - repo_tags = ( - image_config['RepoTags'][0].rsplit(':', 1) if image_config['RepoTags'] - else ('', '') - ) + service = self.project.get_service(container.service) + if service.image_name in image_config['RepoTags']: + index = image_config['RepoTags'].index(service.image_name) + repo_tags = ( + image_config['RepoTags'][index].rsplit(':', 1) if image_config['RepoTags'] + else ('', '') + ) + else: + repo_tags = ( + image_config['RepoTags'][0].rsplit(':', 1) if image_config['RepoTags'] + else ('', '') + ) image_id = image_config['Id'].split(':')[1][:12] size = human_readable_file_size(image_config['Size']) rows.append([