Fix cleanup of old images

This commit is contained in:
Girish Ramakrishnan
2018-09-15 18:41:06 -07:00
parent 64a7b80395
commit 391ee00db8
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -117,9 +117,9 @@ function removeOldImages(callback) {
for (var imageName in infra.images) {
if (imageName === 'redis') continue; // see #223
const image = infra.images[imageName];
const tag = image.tag.replace(/@sha256.*/, '');
const tag = image.tag.replace(/:.*@/, '@'); // this remove the semver tag
debug('cleaning up images of %j', image);
const cmd = `docker images "${image.repo}" | tail -n +2 | awk '{ print $1 ":" $2 }' | grep -v "${tag}" | xargs --no-run-if-empty docker rmi`;
const cmd = `docker images --digests "${image.repo}" | tail -n +2 | awk '{ print $1 "@" $3 }' | grep -v "${tag}" | xargs --no-run-if-empty docker rmi`;
shell.execSync('removeOldImagesSync', cmd);
}