From 8f0955bcd8c4b0659641b5ab1a0f664893a65b16 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Tue, 25 Mar 2025 12:34:03 +0100 Subject: [PATCH] refactor(network): check for existing coolify network before creation --- other/nightly/upgrade.sh | 8 +++++--- scripts/upgrade.sh | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/other/nightly/upgrade.sh b/other/nightly/upgrade.sh index c948f1368..54958ba56 100644 --- a/other/nightly/upgrade.sh +++ b/other/nightly/upgrade.sh @@ -30,9 +30,11 @@ fi # Make sure coolify network exists # It is created when starting Coolify with docker compose -if ! docker network create --attachable --ipv6 coolify 2>/dev/null; then - echo "Failed to create coolify network with ipv6. Trying without ipv6..." - docker network create --attachable coolify 2>/dev/null +if ! docker network inspect coolify >/dev/null 2>&1; then + if ! docker network create --attachable --ipv6 coolify 2>/dev/null; then + echo "Failed to create coolify network with ipv6. Trying without ipv6..." + docker network create --attachable coolify 2>/dev/null + fi fi # docker network create --attachable --driver=overlay coolify-overlay 2>/dev/null diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh index 71959c8b9..e3db2ea81 100644 --- a/scripts/upgrade.sh +++ b/scripts/upgrade.sh @@ -30,9 +30,11 @@ fi # Make sure coolify network exists # It is created when starting Coolify with docker compose -if ! docker network create --attachable --ipv6 coolify 2>/dev/null; then - echo "Failed to create coolify network with ipv6. Trying without ipv6..." - docker network create --attachable coolify 2>/dev/null +if ! docker network inspect coolify >/dev/null 2>&1; then + if ! docker network create --attachable --ipv6 coolify 2>/dev/null; then + echo "Failed to create coolify network with ipv6. Trying without ipv6..." + docker network create --attachable coolify 2>/dev/null + fi fi # docker network create --attachable --driver=overlay coolify-overlay 2>/dev/null