run.manager.sh 1.0 KB
#! /bin/sh
container_name="dmapmanager"
#停止容器
echo "正在关闭容器..."
docker stop $container_name
docker rm $container_name

curPath=$(readlink -f $(dirname $0))


#设置日志权限
chmod -R 777 $curPath

#设置端口
port=""
if [ ! -n "$1" ] ;then

port1="8830"
echo "未设置端口1,使用默认8830端口..."
else
port1=$1
echo "端口1设置为$1 ..."
fi

port2=""
if [ ! -n "$2" ] ;then
port2="8840"
echo "未设置端口2,使用默认8840端口..."
else
port2=$2
echo "端口2设置为$2 ..."
fi


#启动容器
echo "正在启动容器..."

set="--restart=always -e ALLOW_IP_RANGE=0.0.0.0/0 -p  $port1:80 -p $port2:81 "
codeMap="-v ${curPath}:/usr/src/app -v ${curPath}/html:/var/www/html"
apacheMap="-v ${curPath}/apache2.conf:/etc/apache2/apache2.conf -v ${curPath}/dmapmanager.conf:/etc/apache2/sites-enabled/dmapmanager.conf -v ${curPath}/envvars:/etc/apache2/envvars"

docker run -it -d --name ${container_name} ${set} ${codeMap} ${apacheMap} dci/dmapmanager:4.1
sleep 5
curl localhost:$port2/release