Fix an issue where an image would not be cleaned up if it was tagged in multiple repos.

This commit is contained in:
Pagan Gazzard 2015-07-08 20:09:58 +01:00 committed by Pablo Carranza Vélez
parent 0931e8a16b
commit 3ad47adce4
3 changed files with 8 additions and 6 deletions

View File

@ -1,3 +1,4 @@
* Fixed an issue where an image would not be cleaned up if it was tagged in multiple repos. [Page]
* Use JOBS=MAX for npm install. [Page] * Use JOBS=MAX for npm install. [Page]
* Updated pinejs-client so that valid ssl certificates are enforced by default. [Page] * Updated pinejs-client so that valid ssl certificates are enforced by default. [Page]
* Write the `registered_at` time to config.json as well, in case there is a failure between writing to config.json and writing to knex [Page] * Write the `registered_at` time to config.json as well, in case there is a failure between writing to config.json and writing to knex [Page]

View File

@ -11,7 +11,7 @@
"bluebird": "^2.9.24", "bluebird": "^2.9.24",
"body-parser": "^1.12.0", "body-parser": "^1.12.0",
"coffee-script": "~1.9.1", "coffee-script": "~1.9.1",
"dockerode": "~2.1.1", "dockerode": "~2.2.1",
"event-stream": "^3.0.20", "event-stream": "^3.0.20",
"express": "^4.0.0", "express": "^4.0.0",
"knex": "~0.8.3", "knex": "~0.8.3",

View File

@ -93,11 +93,12 @@ do ->
_.any image.RepoTags, (tag) -> _.any image.RepoTags, (tag) ->
return _.contains(appTags, tag) or _.contains(supervisorTags, tag) return _.contains(appTags, tag) or _.contains(supervisorTags, tag)
Promise.map imagesToClean, (image) -> Promise.map imagesToClean, (image) ->
docker.getImage(image.Id).removeAsync() Promise.map image.RepoTags.concat(image.Id), (tag) ->
.then -> docker.getImage(tag).removeAsync()
console.log('Deleted image:', image.Id, image.RepoTags) .then ->
.catch (err) -> console.log('Deleted image:', tag, image.Id, image.RepoTags)
console.log('Error deleting image:', image.Id, image.RepoTags, err) .catch (err) ->
console.log('Error deleting image:', tag, image.Id, image.RepoTags, err)
containerHasExited = (id) -> containerHasExited = (id) ->
docker.getContainer(id).inspectAsync() docker.getContainer(id).inspectAsync()