feat: get command and output for logs from CleanupDocker
This commit is contained in:
parent
85f38b7cb5
commit
7bdef134e6
1 changed files with 12 additions and 4 deletions
|
|
@ -25,17 +25,25 @@ public function handle(Server $server)
|
|||
"docker images --filter before=$helperImageWithVersion --filter reference=$helperImage | grep $helperImage | awk '{print $3}' | xargs -r docker rmi -f",
|
||||
];
|
||||
|
||||
$serverSettings = $server->settings;
|
||||
if ($serverSettings->delete_unused_volumes) {
|
||||
if ($server->settings->delete_unused_volumes) {
|
||||
$commands[] = 'docker volume prune -af';
|
||||
}
|
||||
|
||||
if ($serverSettings->delete_unused_networks) {
|
||||
if ($server->settings->delete_unused_networks) {
|
||||
$commands[] = 'docker network prune -f';
|
||||
}
|
||||
|
||||
$cleanupLog = [];
|
||||
foreach ($commands as $command) {
|
||||
instant_remote_process([$command], $server, false);
|
||||
$commandOutput = instant_remote_process([$command], $server, false);
|
||||
if ($commandOutput !== null) {
|
||||
$cleanupLog[] = [
|
||||
'command' => $command,
|
||||
'output' => $commandOutput,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $cleanupLog;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue