22 lines
592 B
Bash
Executable File
22 lines
592 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Create shared network for Traefik and all services
|
|
NETWORK_NAME="traefik"
|
|
|
|
echo "Setting up Docker network: $NETWORK_NAME"
|
|
|
|
# Check if network already exists
|
|
if docker network ls | grep -q "$NETWORK_NAME"; then
|
|
echo "Network $NETWORK_NAME already exists"
|
|
else
|
|
# Create the network with a specific subnet to ensure consistency
|
|
docker network create \
|
|
--driver bridge \
|
|
--subnet=172.20.0.0/16 \
|
|
--gateway=172.20.0.1 \
|
|
"$NETWORK_NAME"
|
|
fi
|
|
|
|
echo "Network details:"
|
|
docker network inspect "$NETWORK_NAME" | grep -E "(Name|Subnet|Gateway)"
|