mirror of https://github.com/docker/compose.git
Fix 404 issue, change APIError to more accureate ImageNotFound
Signed-off-by: Jun Guo <blackhumour.gj@gmail.com>
This commit is contained in:
parent
91851cd5ae
commit
cbb730172f
|
@ -10,6 +10,7 @@ from operator import attrgetter
|
||||||
import enum
|
import enum
|
||||||
import six
|
import six
|
||||||
from docker.errors import APIError
|
from docker.errors import APIError
|
||||||
|
from docker.errors import ImageNotFound
|
||||||
from docker.errors import NotFound
|
from docker.errors import NotFound
|
||||||
from docker.types import LogConfig
|
from docker.types import LogConfig
|
||||||
from docker.utils.ports import build_port_bindings
|
from docker.utils.ports import build_port_bindings
|
||||||
|
@ -323,11 +324,8 @@ class Service(object):
|
||||||
def image(self):
|
def image(self):
|
||||||
try:
|
try:
|
||||||
return self.client.inspect_image(self.image_name)
|
return self.client.inspect_image(self.image_name)
|
||||||
except APIError as e:
|
except ImageNotFound:
|
||||||
if e.response.status_code == 404 and e.explanation and 'No such image' in str(e.explanation):
|
|
||||||
raise NoSuchImageError("Image '{}' not found".format(self.image_name))
|
raise NoSuchImageError("Image '{}' not found".format(self.image_name))
|
||||||
else:
|
|
||||||
raise
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def image_name(self):
|
def image_name(self):
|
||||||
|
|
Loading…
Reference in New Issue