def image_version(self, image_name, image_tag):
"""
Returns the Docker image hash of the requested image and tag, or
raises ImageNotFoundException if it's not available on the host.
"""
if image_tag == "local":
image_tag = "latest"
try:
docker_info = self.host.client.inspect_image("{}:{}".format(image_name, image_tag))
return docker_info['Id']
except NotFound:
# TODO: Maybe auto-build if we can?
raise ImageNotFoundException(
"Cannot find image {}:{}".format(image_name, image_tag),
image=image_name,
image_tag=image_tag,
)
评论列表
文章目录