-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_hehe_multi.sh
executable file
·53 lines (45 loc) · 1.12 KB
/
run_hehe_multi.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
#!/bin/bash
# build container
echo "RUN YOUR OWN IMAGE"
image=$1
echo "GOT GPU? y/n:"
read got_gpu
gpu_enabled="--gpus all"
if [ "$got_gpu" == "y" ] || [ "$got_gpu" == "Y" ]; then
image="airo_noetic_hehe:${image}-gpu"
elif [ "$got_gpu" == "n" ] || [ "$got_gpu" == "N" ]; then
gpu_enabled=""
image="airo_noetic_hehe:${image}-nogpu"
else
echo "PLEASE CHECK YOUR INPUT!"
exit 1
fi
if [ "$(docker images -q $image 2> /dev/null)" == "" ]; then
echo ""
echo "ERROR. PLEASE CHECK THE EXISTENCE OF UR IMAGE!"
echo ""
exit 1
else
echo ""
fi
echo "NOW RUNNING IMAGE -> CONTAINER"
echo "CONTAINER BASED ON IMAGE: $image"
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
sudo docker run \
-it \
--network host \
--privileged \
$gpu_enabled \
--volume=$XSOCK:$XSOCK:rw \
--volume=$XAUTH:$XAUTH:rw \
--env="XAUTHORITY=${XAUTH}" \
--env DISPLAY=$DISPLAY \
--env TERM=xterm-256color \
--env ROS_HOSTNAME=192.168.50.125 \
--env ROS_MASTER_URI=http://192.168.50.172:11311 \
-v /dev:/dev \
$image \
/bin/bash