-
Notifications
You must be signed in to change notification settings - Fork 5
/
start-docker
executable file
·52 lines (48 loc) · 1.47 KB
/
start-docker
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
#!/usr/bin/env bash
if [[ $1 == wildfly ]]; then
Container="wildfly"
publishplus="--publish 9990:9990"
shift
elif [[ $1 == tomee ]]; then
Container="tomee"
publishplus=""
shift
elif [[ $1 == glassfish ]]; then
Container="glassfish"
publishplus="--publish 4848:4848"
shift
elif [[ $1 == openliberty ]]; then
Container="openliberty"
publishplus="--publish 4848:4848"
shift
else
Container="openliberty"
publishplus="--publish 4848:4848"
fi
if [[ $# -eq 0 ]] ; then
master=localhost
cassandra=localhost
network=
publish="--publish 8080:8080 --publish 4040:4040 --publish 9870:9870"
format="{{.NetworkSettings.IPAddress}}"
else
master=$1
if [[ -n "${2}" ]]; then
cassandra=$2
else
cassandra=$master
fi
network="--network spark_default"
publish=""
format="{{.NetworkSettings.Networks.spark_default.IPAddress}}"
fi
set -x
docker run --name ${Container} --hostname ${Container} --rm $network --env HDFS_USER=${USER} --env HADOOP_USER_NAME=${USER} --publish 9080:9080 $publish $publishplus derrickoswald/cimapplication:${Container} start-${Container} $master $cassandra &
set +x
echo `docker inspect -f {{.State.Running}} ${Container} 2>/dev/null`
until [ "`docker inspect -f {{.State.Running}} ${Container} 2>/dev/null`"=="true" ]; do
sleep 0.5;
done;
set -x
ipaddress=$(docker inspect --format=${format} ${Container})
sudo sed -i '/'"$Container"'/c\'"$ipaddress $Container" /etc/hosts