From 433f0920c82c68cf8c1601916e09a1096df05f4b Mon Sep 17 00:00:00 2001 From: Aleksis Brezas Date: Tue, 18 Nov 2014 19:10:20 +0000 Subject: [PATCH] remove exited supervisors --- src/docker-utils.coffee | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/docker-utils.coffee b/src/docker-utils.coffee index 769d28a0..8298298d 100644 --- a/src/docker-utils.coffee +++ b/src/docker-utils.coffee @@ -60,14 +60,14 @@ do -> .map (app) -> app.imageId + ':latest' .then (apps) -> - # Make sure not to delete the supervisor image! - apps.push(config.localImage + ':latest') - apps.push(config.remoteImage + ':latest') - # Cleanup containers first, so that they don't block image removal. + supervisorImages = [ "#{config.localImage}:latest", "#{config.remoteImage}:latest" ] docker.listContainersAsync(all: true) .filter (containerInfo) -> - !_.contains(apps, containerInfo.Image) or !containerInfo.Status + isUserApp = _.contains(apps, containerInfo.Image) + isSupervisor = _.contains(supervisorImages, containerInfo.Image) + isRunning = !!containerInfo.Status + not (isUserApp or (isSupervisor and isRunning)) .map (containerInfo) -> docker.getContainer(containerInfo.Id).removeAsync() .then ->