forked from sunfu-chou/LoCoBot-RSA
-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker_run.bash
46 lines (40 loc) · 1.09 KB
/
docker_run.bash
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=("$@")
NAME=rsa
REPOSITORY="argnctu/rsa"
TAG="latest"
REPO_NAME=LoCoBot-RSA
IMG="${REPOSITORY}:${TAG}"
# 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
docker run \
-it \
--rm \
-e DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=$XAUTH \
-v "$XAUTH:$XAUTH" \
-v "/home/$USER/${REPO_NAME}:/home/rsa/${REPO_NAME}" \
-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" \
--user "root:root" \
--workdir "/home/rsa/${REPO_NAME}" \
--name "${NAME}" \
--network host \
--privileged \
--security-opt seccomp=unconfined \
"${IMG}" \
bash