Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions dockrice/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@
from typing import Union


def image_is_not_on_server(e):
"""Checks an docker.error.APIError for if it means
the image can not be found."""

message = e.response.json()["message"].lower()
return (
"manifest invalid" in message
or "manifest unknown" in message
or "name invalid" in message
or "name unknown" in message
)


def get_image(
image: Union[str, docker.models.images.Image],
client: docker.DockerClient = None,
Expand Down Expand Up @@ -60,6 +73,9 @@ def get_image(
except docker.errors.APIError as e:
if not try_login:
raise e
# this means it can't find it, no point in logging in
if image_is_not_on_server(e):
raise e
kwargs = {}
if "/" in image:
registry = image.split("/")[0]
Expand Down