mailcow/build-network.sh

14 lines
456 B
Bash
Raw Normal View History

2016-12-10 03:39:02 +08:00
#!/bin/bash
. mailcow.conf
if [[ -z $(docker network ls --filter "name=${DOCKER_NETWORK}" -q) ]]; then
docker network create ${DOCKER_NETWORK} --subnet ${DOCKER_SUBNET}
else
2016-12-11 21:13:17 +08:00
if [[ $(docker network inspect mailcow-network --format='{{range .IPAM.Config}}{{.Subnet}}{{end}}' 2> /dev/null) != ${DOCKER_SUBNET} ]]; then
echo "ERROR: mailcow network exists, but has wrong subnet!"
exit 1
fi
echo "Correct mailcow network exists, skipped..."
2016-12-10 03:39:02 +08:00
exit 0
fi