Skip to content

Commit

Permalink
Add additional way to fetch docker repo digest (#3231)
Browse files Browse the repository at this point in the history
  • Loading branch information
schustmi authored Dec 3, 2024
1 parent 2b843f4 commit ff3e2ee
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/zenml/utils/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,14 @@ def push_image(
logger.info("Finished pushing Docker image.")

image_name_without_tag, _ = image_name.rsplit(":", maxsplit=1)

image = docker_client.images.get(image_name)
repo_digests: List[str] = image.attrs["RepoDigests"]

for digest in repo_digests:
if digest.startswith(f"{image_name_without_tag}@"):
return digest

for info in reversed(aux_info):
try:
repo_digest = info["Digest"]
Expand Down Expand Up @@ -304,6 +312,7 @@ def get_image_digest(image_name: str) -> Optional[str]:

image = docker_client.images.get(image_name)
repo_digests = image.attrs["RepoDigests"]

if len(repo_digests) == 1:
return cast(str, repo_digests[0])
else:
Expand Down

0 comments on commit ff3e2ee

Please sign in to comment.