fix delte networks and unused images of services when deleted
This commit is contained in:
parent
10b9c4bcfa
commit
df796dffa2
1 changed files with 9 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Actions\Service;
|
||||
|
||||
use App\Models\Service;
|
||||
use App\Actions\Server\CleanupDocker;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
||||
class DeleteService
|
||||
|
|
@ -33,6 +34,11 @@ public function handle(Service $service)
|
|||
foreach ($storagesToDelete as $storage) {
|
||||
$commands[] = "docker volume rm -f $storage->name";
|
||||
}
|
||||
|
||||
$uuid = $service->uuid;
|
||||
instant_remote_process(["docker network disconnect {$uuid} coolify-proxy"], $server, false);
|
||||
instant_remote_process(["docker network rm {$uuid}"], $server, false);
|
||||
|
||||
$commands[] = "docker rm -f $service->uuid";
|
||||
|
||||
instant_remote_process($commands, $server, false);
|
||||
|
|
@ -50,6 +56,9 @@ public function handle(Service $service)
|
|||
$task->delete();
|
||||
}
|
||||
$service->tags()->detach();
|
||||
$service->forceDelete();
|
||||
|
||||
CleanupDocker::run($server, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue