From 1a77feea3f6f938d0511a2dcc5f2f8c7b14a720c Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Wed, 29 Apr 2015 17:54:33 +0100 Subject: [PATCH] Close connection before attaching on 'up' and 'run' This ensures that the connection is not recycled, which can cause the Docker daemon to complain if we've already performed another streaming call such as doing a build. Signed-off-by: Aanand Prasad --- compose/service.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compose/service.py b/compose/service.py index 43230be3d5..b81922dd16 100644 --- a/compose/service.py +++ b/compose/service.py @@ -476,6 +476,11 @@ class Service(object): except StreamOutputError as e: raise BuildError(self, unicode(e)) + # Ensure the HTTP connection is not reused for another + # streaming command, as the Docker daemon can sometimes + # complain about it + self.client.close() + image_id = None for event in all_events: