I've been using the the Docker Python API and Boto3 to build images and push them to Amazon ECR. What I've having difficultly determining is how do I determine if an Image I build already exists in ECR? I can use the Boto3 libraries like so:
import boto3
import botocore
client = boto3.client('ecr')
images = client.list_images(repositoryName=repo_name, registryId=repo_id)
This will give me a list of digests, but they're not the Image digests. They're the Docker repository digests (which is a digest of the image + its manifest). So if I build an image locally, I can't use this to check to see if the image already exists with a tag on Amazon ECR.
import docker
client = docker.from_env()
image = client.build(path=docker_dir)
sha256 = image[0].id # <--This Sha sum is for the image, different from repository
Is there anyway to get the actual image digest for images in a given repository without having to pull the image?