-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker_run_ros2.sh
More file actions
47 lines (42 loc) · 1.33 KB
/
docker_run_ros2.sh
File metadata and controls
47 lines (42 loc) · 1.33 KB
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
#!/usr/bin/env bash
ARGS=("$@")
# 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
# Prevent executing "docker run" when xauth failed.
if [ ! -f $XAUTH ]; then
echo "[$XAUTH] was not properly created. Exiting..."
exit 1
fi
BASH_OPTION=bash
docker run \
-it \
--rm \
-e DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=$XAUTH \
-e ROS_MASTER_URI=$ROS_MASTER_URI \
-e ROS_IP=$ROS_IP \
-v "$XAUTH:$XAUTH" \
-v "/home/$USER/robotics_middleware_trial_python_turtle_ros2:/home/rpirobotics/robotics_middleware_trial_python_turtle_ros2" \
-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" \
-v "/home/$USER/.bashrc:/home/rpirobotics/.bashrc" \
--name rpirobotics_ros2_foxy \
--network host \
--privileged \
--security-opt seccomp=unconfined \
erickiemvp/ros2:foxy_essential \
$BASH_OPTION