'List images used by the created containers.
Usage: images [options] [SERVICE...]
Options:
-q     Only display IDs'

def images(self, options):

    containers = sorted((self.project.containers(service_names=options[u'SERVICE'], stopped=True) + self.project.containers(service_names=options[u'SERVICE'], one_off=OneOffFilter.only)), key=attrgetter(u'name'))
    if options[u'-q']:
        for image in set((c.image for c in containers)):
            print(image.split(u':')[1])
    else:
        headers = [u'Container', u'Repository', u'Tag', u'Image    Id', u'Size']
        rows = []
        for container in containers:
            image_config = container.image_config
            repo_tags = image_config[u'RepoTags'][0].split(u':')
            image_id = image_config[u'Id'].split(u':')[1][:12]
            size = human_readable_file_size(image_config[u'Size'])
            rows.append([container.name, repo_tags[0], repo_tags[1], image_id, size])
        print(Formatter().table(headers, rows))
