run.ubuntu.apache.sh 1.1 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
port="8840"
echo "未设置端口,使用默认8840端口..."
else
port=$1
echo "端口设置为$1 ..."
fi

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


#启动容器和apache
echo "正在启动容器..."
set="--privileged=true -e TZ="Asia/Shanghai" --restart=always -e ALLOW_IP_RANGE=0.0.0.0/0 -e LAND=C.UTF-8"
docker run -it -d --name ${container_name} ${set} -p ${port}:81 -p ${port2}:82 -v ${curPath}:/usr/src/app -v ${curPath}/apache2.conf:/etc/apache2/apache2.conf -v ${curPath}/dmapmanager.conf:/etc/apache2/sites-enabled/dmapmanager.conf -v ${curPath}/envvars:/etc/apache2/envvars dci/dmapserver:build
docker exec -d $container_name service apache2 start
sleep 5
curl localhost:$port/release
curl localhost:$port2