@lru_cache()<EOL>def image_needs_building(image):
d = docker_client()<EOL>try:<EOL><INDENT>d.images.get(image)<EOL><DEDENT>except docker.errors.ImageNotFound:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>return False<EOL><DEDENT>return image_needs_pushing(image)<EOL>
Return whether an image needs building

    Checks if the image exists (ignores commit range),
    either locally or on the registry.

    Args:

    image (str): the `repository:tag` image to be build.

    Returns:

    True: if image needs to be built
    False: if not (image already exists)