-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path02_run_container.sh
executable file
·61 lines (54 loc) · 1.64 KB
/
02_run_container.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
56
57
58
59
60
61
#!/bin/bash
if [ ! -d "Commands" ]
then
mkdir -p "Commands/bin"
fi
if [ ! -d "Projects/dev_ws_src" ]
then
mkdir -p "Projects/dev_ws_src"
fi
if [ ! -d "ExampleCode" ]
then
mkdir -p "ExampleCode"
fi
if ! command -v glxinfo &> /dev/null
then
echo "glxinfo command not found! Execute \'sudo apt install mesa-utils\' to install it."
exit
fi
vendor=`glxinfo | grep vendor | grep OpenGL | awk '{ print $4 }'`
#xhost +local:docker
# --device=/dev/video0:/dev/video0
# For non root usage:
# RUN sudo usermod -a -G video developer
if [ $vendor == "NVIDIA" ]; then
docker run -it --rm \
--name ros2_foxy_desktop \
--hostname ros2_foxy_desktop \
--device /dev/snd \
--env="DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
-v `pwd`/Commands/bin:/home/user/bin \
-v `pwd`/ExampleCode:/home/user/ExampleCode \
-v `pwd`/Projects/dev_ws_src:/home/user/Projects/dev_ws/src \
-env="XAUTHORITY=$XAUTH" \
--volume="$XAUTH:$XAUTH" \
--gpus all \
ros2_foxy_docker:latest \
bash
else
docker run --privileged -it --rm \
--name ros2_foxy_desktop \
--hostname ros2_foxy_desktop \
--volume=/tmp/.X11-unix:/tmp/.X11-unix \
-v `pwd`/Commands/bin:/home/user/bin \
-v `pwd`/ExampleCode:/home/user/ExampleCode \
-v `pwd`/Projects/dev_ws_src:/home/user/Projects/dev_ws/src \
--device=/dev/dri:/dev/dri \
--env="DISPLAY=$DISPLAY" \
-e "TERM=xterm-256color" \
--cap-add SYS_ADMIN --device /dev/fuse \
ros2_foxy_docker:latest \
bash
fi