-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrestart-all.sh
43 lines (35 loc) · 1.28 KB
/
restart-all.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
#!/bin/bash
# variables
IMG_NAME="mjaglan/ubuntuhadoop2017"
HOST_NAME="testbed"
NETWORK_NAME=$HOST_NAME
# if desired, clean up containers
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
# if desired, clean up images
docker rmi $(docker images -q)
# build the Dockerfile
docker build -t "$IMG_NAME" "$(pwd)"
# Default docker network name is 'bridge', driver is 'bridge', scope is 'local'
# Create a new network with any name, and keep 'bridge' driver for 'local' scope.
NET_QUERY=$(docker network ls | grep -i $NETWORK_NAME)
if [ -z "$NET_QUERY" ]; then
echo "Create network >>> $NETWORK_NAME"
docker network create --driver=bridge $NETWORK_NAME
fi
# start hadoop container
: '
LINK: https://stackoverflow.com/a/35901232
Daemon Default Port Configuration Parameter
----------------------- ------------ ----------------------------------
ResourceManager 8088 yarn.resourcemanager.webapp.address
Namenode 50070 dfs.http.address
Secondarynamenode 50090 dfs.secondary.http.address
'
docker run --name "$HOST_NAME" -h "$HOST_NAME" --net=$NETWORK_NAME \
-p 8088:8088 -p 50070:50070 -p 50090:50090 \
-itd "$IMG_NAME"
# see active docker containers
docker ps
# attach to hadoop container
docker attach "$HOST_NAME"