Overlap error now detects prior install

This commit is contained in:
TechHutTV
2026-08-25 15:32:52 +02:00
parent 329cbdfd51
commit 914da63984

View File

@@ -523,9 +523,19 @@ check_docker_subnet_conflicts() {
fi
elif cidrs_overlap "$DOCKER_SUBNET" "$subnet"; then
echo "ERROR: the existing Docker network '$name' ($subnet) overlaps $DOCKER_SUBNET, the subnet NetBird would use." > /dev/stderr
echo "That network is not managed by this script and is left untouched." > /dev/stderr
echo "Pick a free /24 for NetBird instead and run this script again:" > /dev/stderr
echo " NETBIRD_DOCKER_SUBNET=10.123.45.0/24 ./getting-started.sh" > /dev/stderr
# Every network this script creates is named <project>_netbird, so that
# suffix means a NetBird install in another directory rather than an
# unrelated network. Suggesting a different subnet there would not help:
# the container names are fixed, so a second install collides regardless.
if [[ "$name" == *_netbird ]]; then
echo "That network was created by a NetBird install in a different directory." > /dev/stderr
echo "Run this script from that directory instead, or remove the old install first." > /dev/stderr
echo "Find it with: docker network inspect $name" > /dev/stderr
else
echo "That network is not managed by this script and is left untouched." > /dev/stderr
echo "Pick a free /24 for NetBird instead and run this script again:" > /dev/stderr
echo " NETBIRD_DOCKER_SUBNET=10.123.45.0/24 ./getting-started.sh" > /dev/stderr
fi
exit 1
fi
done