From 0e3da8f2f028aed81fb30ffec0c573a4f52f3d41 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 22 May 2017 10:35:13 -0700 Subject: [PATCH] catch ImageNotFound on initial pull --- builder/app.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/builder/app.py b/builder/app.py index fc6711fd..3545bad7 100644 --- a/builder/app.py +++ b/builder/app.py @@ -100,16 +100,19 @@ class Builder(Application): client = docker.APIClient(version='auto', **kwargs_from_env()) repo, tag = self.output_image_spec.split(':') - for line in client.pull( - repository=repo, - tag=tag, - stream=True, - ): - progress = json.loads(line.decode('utf-8')) - if 'error' in progress: - break - else: - return + try: + for line in client.pull( + repository=repo, + tag=tag, + stream=True, + ): + progress = json.loads(line.decode('utf-8')) + if 'error' in progress: + break + else: + return + except docker.errors.ImageNotFound: + pass output_path = os.path.join(self.git_workdir, self.build_name) self.fetch(