From 012d660886c3b9e276d1cb78231520a127fd8a19 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 5 Aug 2024 18:16:29 +0200 Subject: [PATCH] fix: remove network if it is only connected to coolify proxy itself --- app/Console/Commands/Init.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php index f397d8861..754b95e6b 100644 --- a/app/Console/Commands/Init.php +++ b/app/Console/Commands/Init.php @@ -104,6 +104,15 @@ class Init extends Command if (empty($out)) { $commands->push("docker network disconnect $network coolify-proxy >/dev/null 2>&1 || true"); $commands->push("docker network rm $network >/dev/null 2>&1 || true"); + } else { + $data = collect(json_decode($out, true)); + if ($data->count() === 1) { + $isCoolifyProxyItself = data_get($data->first(), 'Name') === 'coolify-proxy'; + if ($isCoolifyProxyItself) { + $commands->push("docker network disconnect $network coolify-proxy >/dev/null 2>&1 || true"); + $commands->push("docker network rm $network >/dev/null 2>&1 || true"); + } + } } } if ($commands->isNotEmpty()) {