forked from sunsided/ros-gazebo-gpu-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-nvidia.sh
executable file
·39 lines (32 loc) · 890 Bytes
/
run-nvidia.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
#!/usr/bin/env bash
# See http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration
set -euo pipefail
# See README.md for building this image.
CONTAINER_NAME=ros
DOCKER_IMAGE=sunside/ros-gazebo-gpu:kinetic-nvidia
# Which GPUs to use; see https://github.com/NVIDIA/nvidia-docker
GPUS="all"
XSOCK=/tmp/.X11-unix
XAUTH=`pwd`/.tmp/docker.xauth
XAUTH_DOCKER=/tmp/.docker.xauth
if [ ! -f $XAUTH ]
then
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ ! -z "$xauth_list" ]
then
echo "$xauth_list" | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi
docker run --rm -it \
--name "$CONTAINER_NAME" \
--gpus "$GPUS" \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--env="XAUTHORITY=$XAUTH_DOCKER" \
--volume="$XSOCK:$XSOCK:rw" \
--volume="$XAUTH:$XAUTH_DOCKER:rw" \
$DOCKER_IMAGE \
bash