Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor(network): check for existing coolify network before creation

Andras Bacsai8f0955bcd8c4
diff --git a/other/nightly/upgrade.sh b/other/nightly/upgrade.sh
index c948f13684..54958ba566 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 71959c8b93..e3db2ea817 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