run.apache.ubuntu.x86.sh
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /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.x86.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.0-x86
sleep 5
curl localhost:$port2/release