LibrePortal/scripts/docker/network/network_setup.sh
librelad 875a60f90f LibrePortal v0.1.0 — initial release
A free, open, self-hosted app platform (GNU AGPLv3): one-click app deploys,
Traefik reverse proxy with automatic SSL, rootless Docker support, gluetun
VPN routing, and a web dashboard to manage it all.

Free & open forever to self-host; optional paid hosted services fund it.
See PROMISE.md.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 20:37:54 +01:00

35 lines
1022 B
Bash
Executable File

#!/bin/bash
installDockerNetwork()
{
# Check if network setup is needed
if [[ "$DOCKER_NETWORK_SETUP_NEEDED" == "true" ]]; then
isHeader "Create a Docker Network"
isNotice "Network $CFG_NETWORK_NAME not found, creating now"
# Check if we need to generate a new subnet
updateDockerNetworkSubnet
# Create the Docker network command
local network_create="docker network create \
--driver=bridge \
--subnet=$CFG_NETWORK_SUBNET \
--ip-range=${CFG_NETWORK_SUBNET%.*}.0/24 \
--gateway=${CFG_NETWORK_SUBNET%.*}.1 \
--opt com.docker.network.bridge.name=$CFG_NETWORK_NAME \
$CFG_NETWORK_NAME"
# Run the network creation command
local result=$(dockerCommandRun "$network_create")
if [[ $? -eq 0 ]]; then
checkSuccess "Docker network $CFG_NETWORK_NAME created successfully"
else
isError "Failed to create Docker network $CFG_NETWORK_NAME"
isError " $result"
fi
else
isNotice "Docker network $CFG_NETWORK_NAME already exists or setup not needed"
fi
}