Skip to content

Commit

Permalink
freisa_on_mars/run.sh: Add more command-line options to docker run
Browse files Browse the repository at this point in the history
Signed-off-by: Gianpaolo Macario <[email protected]>
  • Loading branch information
gmacario committed Sep 10, 2024
1 parent 7bc25b9 commit ac35d7c
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions freisa_on_mars/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,32 @@ IMG_NAME=baroloteam/freisa_on_mars
CONTAINER_NAME="$(tr '/' '_' <<< "$IMG_NAME")"

# Start the container
docker run --rm -it --name $CONTAINER_NAME --network host \
-e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 $IMG_NAME
#
# --rm: delete container after exiting
# -it: Interactive TTY mode so you can use a shell.
# --network host: Does not isolate Docker container from host's network interfaces.
# Allows all traffic to pass through as if it originated from the host.
# In our case, useful for DDS traffic for ROS.
# -e DISPLAY: Pass the X11 display through to the container.
# -e TERM: Pass the kind of terminal being used through to the container.
# -e QT_X11_NO_MITSHM=1: Disables shared memory extension for Qt/X11, which does not work consistently inside a process namespace like a container.
# -v "$XAUTHORITY:/.Xauthority": the $XAUTHORITY environment variable on the host contains the path to a file that grants access to X11.
# We mount the path defined in that environment variable into the container at /.Xauthority.
# -e XAUTHORITY=/.Xauthority: We set $XAUTHORITY *inside* the container to the place we just mounted the Xauthority (/.Xauthority)
#
# Credits:
# * https://github.com/space-ros/docker/pull/168
# * https://github.com/space-ros/docker/pull/175
#
docker run --rm -it --name $CONTAINER_NAME \
--network host \
--volume=/tmp/.X11-unix:/tmp/.X11-unix \
--device=/dev/dri:/dev/dri \
--volume "$XAUTHORITY:/.Xauthority" \
-e DISPLAY \
-e TERM \
-e QT_X11_NO_MITSHM=1 \
-e XAUTHORITY=/.Xauthority \
$IMG_NAME

# EOF

0 comments on commit ac35d7c

Please sign in to comment.