From 2e9ed077086b28345d51573bfb8672032241ff72 Mon Sep 17 00:00:00 2001 From: xtcnet Date: Tue, 17 Mar 2026 22:31:13 +0700 Subject: [PATCH] fix(install): skip d3v-net in compose when Forgejo is not installed generate_docker_compose now only adds the d3v-net network section if the network actually exists on the host. Servers without Forgejo no longer fail with "network declared as external, but could not be found". Co-Authored-By: Claude Sonnet 4.6 --- install.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/install.sh b/install.sh index e8cb540..e8b8493 100644 --- a/install.sh +++ b/install.sh @@ -145,7 +145,7 @@ generate_docker_compose() { fi log_step "Generating docker-compose.yml..." - + local custom_ports_block="" if [ -f ".custom_ports" ]; then while IFS= read -r port_mapping; do @@ -155,6 +155,18 @@ generate_docker_compose() { done < ".custom_ports" fi + # Only include d3v-net if the network already exists (i.e. Forgejo is installed) + local network_block="" + if docker network ls --format '{{.Name}}' 2>/dev/null | grep -q "^${DOCKER_NETWORK}$"; then + network_block=" networks: + - d3v-net + +networks: + d3v-net: + external: true + name: ${DOCKER_NETWORK}" + fi + cat > "$COMPOSE_FILE" <