def try_pull_image_from_registry(self, image_name, image_tag):
        """
        Tries to pull a image with the tag ``image_tag`` from registry set by ``use_registry_name``.
        After the image is pulled, it's tagged with ``image_name``:``image_tag`` so lookup can
        be made locally next time.

        :return: A :class:`Image <docker.models.images.Image>` instance if the image exists, ``None`` otherwise.
        :rtype: Optional[docker.models.images.Image]
        """
        try:
            image = self.client.images.pull(self.use_registry_name, image_tag)
        except (docker.errors.ImageNotFound, docker.errors.NotFound):  # the image doesn't exist
            logger.info("Tried to pull %s:%s from a registry, not found", self.use_registry_name, image_tag)
            return None

        logger.info("Pulled %s:%s from registry, tagged %s:%s", self.use_registry_name, image_tag,
                    image_name, image_tag)

        # the name and tag are different on the repo, let's tag it with local name so exists checks run smoothly
        image.tag(image_name, image_tag)

        return image
def try_pull_image_from_registry ( self , image_name , image_tag ) : try : image = self . client . images . pull ( self . use_registry_name , image_tag ) except ( docker . errors . ImageNotFound , docker . errors . NotFound ) : logger . info ( "Tried to pull %s:%s from a registry, not found" , self . use_registry_name , image_tag ) return None logger . info ( "Pulled %s:%s from registry, tagged %s:%s" , self . use_registry_name , image_tag , image_name , image_tag ) image . tag ( image_name , image_tag ) return image
Tries to pull a image with the tag ``image_tag`` from registry set by ``use_registry_name``.
        After the image is pulled, it's tagged with ``image_name``:``image_tag`` so lookup can
        be made locally next time.

        :return: A :class:`Image <docker.models.images.Image>` instance if the image exists, ``None`` otherwise.
        :rtype: Optional[docker.models.images.Image]