From f546ca8817cc1a45f364f1c8872b5dd57fcb5ed4 Mon Sep 17 00:00:00 2001 From: Gilles Grandou Date: Fri, 30 Apr 2021 11:32:39 +0200 Subject: [PATCH] catch run errors --- runon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runon b/runon index b67f81f..a6c1eff 100755 --- a/runon +++ b/runon @@ -125,8 +125,12 @@ def create_container(client, image, conf, command, verbose): def run_container(client, container): - dockerpty.start(client.api, container.id) - container.reload() # to update attrs fields + try: + dockerpty.start(client.api, container.id) + container.reload() # to update attrs fields + except docker.errors.APIError as e: + print('ERROR: {}'.format(e)) + sys.exit(1) ret = container.attrs['State']['ExitCode'] return ret