-
Notifications
You must be signed in to change notification settings - Fork 11
/
docker.sh
executable file
·55 lines (47 loc) · 1.26 KB
/
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
51
52
53
54
55
#!/bin/sh
# To build: 'docker build -t navigator .'
# The below command is to run a docker container. The container must already be built.
# It passes the ROS_DOMAIN_ID from host. To generate this "randomly" based on your username,
# see https://gist.github.com/wheitman/ceaec50cd4cb79a496f43e6c0e20a8b2
if echo $* | grep -e "-h" -q
then
echo "Usage: ./docker.sh"
echo "Add --no-gpu to skip GPUs"
exit
fi
# Give the Docker container access to the x server,
# which allows it to show graphical applications
xhost +
# Without GPUs
if echo $* | grep -e "--no-gpu" -q
then
echo "GPUS DISABLED"
docker run \
-it \
--rm \
-v $PWD:/navigator \
-v /home/share/carla:/workspace \
-v /dev:/dev \
--net=host \
--privileged \
-v $HOME/.Xauthority:/root/.Xauthority \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e="DISPLAY" \
-e ROS_DOMAIN_ID \
navigator
else # With GPUs
docker run \
-it \
--rm \
-v $PWD:/navigator \
-v /home/share/carla:/workspace \
-v /dev:/dev \
--gpus all \
--net=host \
--privileged \
-v $HOME/.Xauthority:/root/.Xauthority \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e="DISPLAY" \
-e ROS_DOMAIN_ID \
navigator
fi