Fix trying to delete supervisor images.

This commit is contained in:
Pagan Gazzard 2014-12-09 19:59:30 +00:00 committed by Pablo Carranza Vélez
parent b1b039cdd1
commit 63f1d66402

View File

@ -55,13 +55,13 @@ do ->
.finally ->
imagesBeingFetched--
supervisorImages = [ "#{config.localImage}:latest", "#{config.remoteImage}:latest" ]
exports.cleanupContainersAndImages = ->
knex('app').select()
.map (app) ->
app.imageId + ':latest'
.then (apps) ->
# Cleanup containers first, so that they don't block image removal.
supervisorImages = [ "#{config.localImage}:latest", "#{config.remoteImage}:latest" ]
docker.listContainersAsync(all: true)
.filter (containerInfo) ->
isUserApp = _.contains(apps, containerInfo.Image)
@ -80,7 +80,7 @@ do ->
docker.listImagesAsync()
.filter (image) ->
!_.any image.RepoTags, (imageId) ->
_.contains(apps, imageId)
_.contains(apps, imageId) or _.contains(supervisorImages, imageId)
.map (image) ->
docker.getImage(image.Id).removeAsync()
.then ->