diff --git a/CHANGELOG.md b/CHANGELOG.md index 39344efa..398d044f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] * 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] diff --git a/package.json b/package.json index d8b2c921..8e3f619d 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "bluebird": "^2.9.24", "body-parser": "^1.12.0", "coffee-script": "~1.9.1", - "dockerode": "~2.1.1", + "dockerode": "~2.2.1", "event-stream": "^3.0.20", "express": "^4.0.0", "knex": "~0.8.3", diff --git a/src/docker-utils.coffee b/src/docker-utils.coffee index 69e11426..f9fca10e 100644 --- a/src/docker-utils.coffee +++ b/src/docker-utils.coffee @@ -93,11 +93,12 @@ do -> _.any image.RepoTags, (tag) -> return _.contains(appTags, tag) or _.contains(supervisorTags, tag) Promise.map imagesToClean, (image) -> - docker.getImage(image.Id).removeAsync() - .then -> - console.log('Deleted image:', image.Id, image.RepoTags) - .catch (err) -> - console.log('Error deleting image:', image.Id, image.RepoTags, err) + Promise.map image.RepoTags.concat(image.Id), (tag) -> + docker.getImage(tag).removeAsync() + .then -> + console.log('Deleted image:', tag, image.Id, image.RepoTags) + .catch (err) -> + console.log('Error deleting image:', tag, image.Id, image.RepoTags, err) containerHasExited = (id) -> docker.getContainer(id).inspectAsync()