-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker_run.sh
35 lines (28 loc) · 959 Bytes
/
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
#!/usr/bin/env bash
## Fail if any command fails (use "|| true" if a command is ok to fail)
set -e
## Treat unset variables as error
set -u
dummy=`which nvidia-docker`;
if test $? -eq 0; then
DOCKER_CMD='nvidia-docker run';
else
DOCKER_CMD='docker run --runtime=nvidia';
fi
## Setup X authority such that the container knows how to do graphical stuff
XSOCK="/tmp/.X11-unix";
XAUTH=`tempfile -s .docker.xauth`;
xauth nlist "${DISPLAY}" \
| sed -e 's/^..../ffff/' \
| xauth -f "${XAUTH}" nmerge -;
PWD="/misc/lmbraid18/zimmermc/projects/FreiPose/tmp/" # TODO remove this
${DOCKER_CMD} \
--rm \
--volume "${XSOCK}:${XSOCK}:rw" \
--volume "${XAUTH}:${XAUTH}:rw" \
--env "XAUTHORITY=${XAUTH}" \
--env DISPLAY \
--volume "${PWD}/data/:/host/:rw" \
--hostname "${HOSTNAME}" \
--env QT_X11_NO_MITSHM=1 \
-it docker-freipose /bin/bash;