forked from ARG-NCTU/oop-proj-17
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_run.sh
executable file
·46 lines (43 loc) · 1.17 KB
/
docker_run.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
#!/usr/bin/env bash
ARGS=("$@")
USER_NAME="arg"
# Make sure processes in the container can connect to the x server
# Necessary so gazebo can create a context for OpenGL rendering (even headless)
XAUTH=/tmp/.docker.xauth
if [ ! -f $XAUTH ]; then
xauth_list=$(xauth nlist $DISPLAY)
xauth_list=$(sed -e 's/^..../ffff/' <<<"$xauth_list")
if [ ! -z "$xauth_list" ]; then
echo "$xauth_list" | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi
# Prevent executing "docker run" when xauth failed.
if [ ! -f $XAUTH ]; then
echo "[$XAUTH] was not properly created. Exiting..."
exit 1
fi
BASH_OPTION=bash
xhost +
docker run \
-it \
--rm \
-e DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=$XAUTH \
-v "$XAUTH:$XAUTH" \
-v "/home/$USER/oop-proj-17:/home/arg/oop-proj-17" \
-v "/tmp/.X11-unix:/tmp/.X11-unix" \
-v "/etc/localtime:/etc/localtime:ro" \
-v "/dev:/dev" \
-v "/var/run/docker.sock:/var/run/docker.sock" \
-w "/home/arg/oop-proj-17" \
--user "root:root" \
--network host \
--privileged \
--security-opt seccomp=unconfined \
argnctu/oop:latest \
$BASH_OPTION
xhost -