-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.sh
executable file
·61 lines (44 loc) · 961 Bytes
/
docker-compose.sh
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
SERVICE_NAME="nrpe"
IMAGE="nsoporte/nrpe:latest"
SERVICE_DATA_STORAGE="/data/apps/nrpe"
ARG1=$1
ARG2=$2
function help
{
echo "docker-compose.sh up/down -params Example: docker-compose.sh up -d"
}
function up
{
if [ "$ARG2" = "" ];then
ARG2="-it"
fi
docker run --name $SERVICE_NAME --net host \
-v /etc/localtime:/etc/localtime:ro \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /etc/issue:/etc/issue.docker:ro \
-v /var/run/utmp:/var/run/utmp \
-v /proc:/host/proc:ro \
-v /data/apps/nrpe/custom:/custom \
-v /data/apps/nrpe/plugins:/plugins \
-v /:/host/rootfs:ro \
-v /var:/host/varfs:ro \
-v /home:/host/homefs:ro \
--restart unless-stopped $ARG2 $IMAGE
}
function down
{
docker stop $SERVICE_NAME
docker rm $SERVICE_NAME
}
case $ARG1 in
up)
up
;;
down)
down
;;
*)
help
;;
esac