docker: rework image pruning
with our new retagging approach, the Digest ID remains <null> because this is only set by docker if truly fetched from the registry. this means that redis container always gets removed...
This commit is contained in:
@@ -1035,6 +1035,8 @@ async function startTurn(existingInfra) {
|
||||
|
||||
debug('startTurn: starting turn container');
|
||||
await shell.bash(runCmd, {});
|
||||
|
||||
if (existingInfra.version !== 'none' && existingInfra.images.turn !== image) await docker.deleteImage(existingInfra.images.turn);
|
||||
}
|
||||
|
||||
async function teardownTurn(app, options) {
|
||||
@@ -1248,6 +1250,8 @@ async function startMysql(existingInfra) {
|
||||
await waitForContainer('mysql', 'CLOUDRON_MYSQL_TOKEN');
|
||||
if (upgrading) await importDatabase('mysql');
|
||||
}
|
||||
|
||||
if (existingInfra.version !== 'none' && existingInfra.images.mysql !== image) await docker.deleteImage(existingInfra.images.mysql);
|
||||
}
|
||||
|
||||
async function setupMySql(app, options) {
|
||||
@@ -1466,6 +1470,8 @@ async function startPostgresql(existingInfra) {
|
||||
await waitForContainer('postgresql', 'CLOUDRON_POSTGRESQL_TOKEN');
|
||||
if (upgrading) await importDatabase('postgresql');
|
||||
}
|
||||
|
||||
if (existingInfra.version !== 'none' && existingInfra.images.postgresql !== image) await docker.deleteImage(existingInfra.images.postgresql);
|
||||
}
|
||||
|
||||
async function setupPostgreSql(app, options) {
|
||||
@@ -1615,6 +1621,8 @@ async function startMongodb(existingInfra) {
|
||||
await waitForContainer('mongodb', 'CLOUDRON_MONGODB_TOKEN');
|
||||
if (upgrading) await importDatabase('mongodb');
|
||||
}
|
||||
|
||||
if (existingInfra.version !== 'none' && existingInfra.images.mongodb !== image) await docker.deleteImage(existingInfra.images.mongodb);
|
||||
}
|
||||
|
||||
async function setupMongoDb(app, options) {
|
||||
@@ -1782,6 +1790,8 @@ async function startGraphite(existingInfra) {
|
||||
debug('startGraphite: starting graphite container');
|
||||
await shell.bash(runCmd, {});
|
||||
|
||||
if (existingInfra.version !== 'none' && existingInfra.images.graphite !== image) await docker.deleteImage(existingInfra.images.graphite);
|
||||
|
||||
// restart collectd to get the disk stats after graphite starts. currently, there is no way to do graphite health check
|
||||
setTimeout(async () => await safe(shell.promises.sudo([ RESTART_SERVICE_CMD, 'collectd' ], {})), 60000);
|
||||
}
|
||||
@@ -1872,6 +1882,8 @@ async function startRedis(existingInfra) {
|
||||
}
|
||||
|
||||
if (upgrading) await importDatabase('redis');
|
||||
|
||||
if (existingInfra.version !== 'none' && existingInfra.images.redis !== image) await docker.deleteImage(existingInfra.images.redis);
|
||||
}
|
||||
|
||||
// Ensures that app's addon redis container is running. Can be called when named container already exists/running
|
||||
|
||||
Reference in New Issue
Block a user