Beispiel #1
0
 def get_docker_image_names(self, strip_latest=True, include_tags=True):
     try:
         images = self.client().images.list()
         image_names = [tag for image in images for tag in image.tags if image.tags]
         if not include_tags:
             image_names = list(map(lambda image_name: image_name.split(":")[0], image_names))
         if strip_latest:
             Util.append_without_latest(image_names)
         return image_names
     except APIError as e:
         raise ContainerException() from e
Beispiel #2
0
    def get_docker_image_names(self, strip_latest=True, include_tags=True):
        format_string = "{{.Repository}}:{{.Tag}}" if include_tags else "{{.Repository}}"
        cmd = self._docker_cmd()
        cmd += ["images", "--format", format_string]
        try:
            output = run(cmd)

            image_names = output.splitlines()
            if strip_latest:
                Util.append_without_latest(image_names)
            return image_names
        except Exception as e:
            LOG.info('Unable to list Docker images via "%s": %s', cmd, e)
            return []