docker: prune volumes on infra change
This commit is contained in:
+11
-1
@@ -75,6 +75,13 @@ async function pruneInfraImages() {
|
||||
}
|
||||
}
|
||||
|
||||
async function pruneVolumes() {
|
||||
debug('pruneVolumes: remove all unused local volumes');
|
||||
|
||||
const [error] = await safe(shell.execArgs('pruneVolumes', 'docker', [ 'volume', 'prune', '--all', '--force' ], {}));
|
||||
if (error) console.log(`Error pruning volumes: ${error.mesage}`);
|
||||
}
|
||||
|
||||
async function createDockerNetwork() {
|
||||
debug('createDockerNetwork: recreating docker network');
|
||||
|
||||
@@ -122,7 +129,10 @@ async function onInfraReady(infraChanged) {
|
||||
debug(`onInfraReady: platform is ready. infra changed: ${infraChanged}`);
|
||||
gStatusMessage = 'Ready';
|
||||
|
||||
if (infraChanged) await safe(pruneInfraImages(), { debug }); // ignore error
|
||||
if (infraChanged) {
|
||||
await safe(pruneInfraImages(), { debug }); // ignore error
|
||||
await safe(pruneVolumes(), { debug }); // ignore error
|
||||
}
|
||||
|
||||
await apps.schedulePendingTasks(AuditSource.PLATFORM);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user