Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
fix: docker tag utils issues (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjmachan committed Apr 12, 2022
1 parent 41975da commit d5c3c1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bentoctl/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def build(
"""
deployment_config = DeploymentConfig.from_file(deployment_config_file)
deployment_config.set_bento(bento_tag)
local_docker_tag = deployment_config.get_local_docker_tag()
local_docker_tag = deployment_config.generate_local_image_tag()
with TempDirectory() as dist_dir:
(
dockerfile_path,
Expand Down
12 changes: 11 additions & 1 deletion bentoctl/docker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,22 @@ def build_docker_image(
def tag_docker_image(image_name, image_tag):
docker_client = docker.from_env()
try:
docker_client.images.tag(image_name, image_tag)
img = docker_client.images.get(image_name)
was_tagged = img.tag("image_tag")
if not was_tagged:
raise BentoctlDockerException(
f"Failed to tag docker image! Function returned False"
)
except docker.errors.APIError as error:
raise BentoctlDockerException(
f"Failed to tag docker image {image_tag}: {error}"
)

except docker.errors.ImageNotFound as error:
raise BentoctlDockerException(
f"Failed to tag Docker image, {image_name} not found."
)


def push_docker_image_to_repository(
repository, image_tag=None, username=None, password=None
Expand Down

0 comments on commit d5c3c1c

Please sign in to comment.