diff --git a/compose/service.py b/compose/service.py index 471f9e199..9d96a4abe 100644 --- a/compose/service.py +++ b/compose/service.py @@ -1856,7 +1856,9 @@ class _CLIBuilder: magic_word = "Successfully built " appear = False - with subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines=True) as p: + with subprocess.Popen(args, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + universal_newlines=True) as p: while True: line = p.stdout.readline() if not line: @@ -1865,6 +1867,10 @@ class _CLIBuilder: appear = True yield json.dumps({"stream": line}) + err = p.stderr.readline().strip() + if err: + raise StreamOutputError(err) + with open(iidfile) as f: line = f.readline() image_id = line.split(":")[1].strip()