diff --git a/src/infra_version.js b/src/infra_version.js index 507ed8aa5..60880f877 100644 --- a/src/infra_version.js +++ b/src/infra_version.js @@ -15,11 +15,11 @@ exports = module.exports = { // This is because we upgrade using dumps instead of mysql_upgrade, pg_upgrade etc // docker inspect --format='{{index .RepoDigests 0}}' $IMAGE to get the sha256 'images': { - 'mysql': { repo: 'cloudron/mysql', tag: 'cloudron/mysql:1.1.0' }, - 'postgresql': { repo: 'cloudron/postgresql', tag: 'cloudron/postgresql:1.1.0' }, + 'mysql': { repo: 'cloudron/mysql', tag: 'cloudron/mysql:1.1.0@sha256:0459023f16e65985e8d74b490b5c4f38c9d1b7a4e5ec8049c08256d42decf00e' }, + 'postgresql': { repo: 'cloudron/postgresql', tag: 'cloudron/postgresql:1.1.0@sha256:731d802211fa08ab951ebac2565048d44526c73948245f18df0ffc27929a8a08' }, 'mongodb': { repo: 'cloudron/mongodb', tag: 'cloudron/mongodb:2.0.0@sha256:b1d8877755463cfc2c14e43d750b9e9d391e1a68814ac0d3ba0f8963e667480a' }, 'redis': { repo: 'cloudron/redis', tag: 'cloudron/redis:2.0.0@sha256:3c35702a751e2b8dfa4f7cdf41c7f899f62329a09beb09b5292b2c1bfe1f6ccb' }, - 'mail': { repo: 'cloudron/mail', tag: 'cloudron/mail:1.4.0' }, + 'mail': { repo: 'cloudron/mail', tag: 'cloudron/mail:1.4.0@sha256:28e65b446569a324f4b28e920d43ac9723f9aa9699a629bec7368a2a74669f88' }, 'graphite': { repo: 'cloudron/graphite', tag: 'cloudron/graphite:1.0.0@sha256:196bf1d19782a015b361da48d06ba1017b3d04b4256d93fbb9c0b50599f69f5d' } } }; diff --git a/src/platform.js b/src/platform.js index c96988e14..9ce238dab 100644 --- a/src/platform.js +++ b/src/platform.js @@ -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); }