-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_docker.sh
executable file
·50 lines (44 loc) · 1.04 KB
/
run_docker.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
#!/bin/bash
if [ "$1" = "" ]
then
HOST_DIR="$PWD"
else
HOST_DIR=$1
fi
while getopts 'g:' OPTION; do
case "$OPTION" in
g)
echo "Using GPUs (need to be NVIDIA)"
GPU="gpus=all"
;;
?)
echo "Using CPU only"
GPU=""
#echo "script usage: $(basename \$0) [-g]" >&1
#exit 1
;;
esac
done
shift "$(($OPTIND -1))"
dockerUserName="user"
SHARED_DIR=/code-sample
##############
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run --rm -it \
--volume=$XSOCK:$XSOCK:rw \
--volume=$XAUTH:$XAUTH:rw \
--env="XAUTHORITY=${XAUTH}" \
--env="DISPLAY" \
--env="UID=`id -u $who`" \
--env="UID=`id -g $who`" \
--device /dev/nvidia0 --device /dev/nvidiactl -e DISPLAY=$DISPLAY \
$GPU \
--privileged \
--net=host\
--volume=/dev:/dev \
--volume=$HOST_DIR:$SHARED_DIR \
parthc/minimal_pcl_cpp_linux:develop \
bash