Example #1
0
    def get_metadata(self):
        """
        Provide metadata about this image.

        :return: ImageMetadata, Image metadata instance
        """
        return inspect_to_metadata(self.metadata, self.inspect(refresh=True))
    def list_images(self):
        """
        List all available docker images.

        Image objects returned from this methods will contain a limited
        amount of metadata in property `short_metadata`. These are just a subset
        of `.inspect()`, but don't require an API call against dockerd.

        :return: collection of instances of :class:`conu.DockerImage`
        """
        response = []
        for im in self.d.images():
            try:
                i_name, tag = parse_reference(im["RepoTags"][0])
            except (IndexError, TypeError):
                i_name, tag = None, None
            d_im = DockerImage(i_name,
                               tag=tag,
                               identifier=im["Id"],
                               pull_policy=DockerImagePullPolicy.NEVER)
            inspect_to_metadata(d_im.metadata, im)

            response.append(d_im)
        return response