Skip to content

Commit

Permalink
Removed rocker dependency (#47)
Browse files Browse the repository at this point in the history
* Removed rocker and now handling everything manually (good luck)

* Minor fix regarding permissions

* Using the official opengl supported nvidia container for each ubuntu version

* Fixed the integrated graphics parameter

* Fixed initial ros version, which was always using melodic
  • Loading branch information
gstavrinos authored Sep 25, 2023
1 parent dda136f commit 478c0a0
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 81 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<img src=media/rosez.png width="444px"/>

Docker 'n' rocker for quick and easy access to ROS2 (humble) and ROS1 (noetic) along with their GUI applications like Gazebo and rViz without the need for a local installation
Docker hacks for quick and easy access to ROS2 (humble) and ROS1 (noetic) along with their GUI applications like Gazebo and rViz without the need for a local installation

## Requirements

* `docker`
* `pip`
* `Linux` (not necessarily Debian-based)
* `dialog` (optionally for interactive terminal UI)

## Instructions
* Make sure your system satisfies all the requirements. The installer script tries to remain distro-agnostic, thus does not install anything apart from `rocker` through `pip`).
* Run the `installer.bash` script with a single argument with the rosez version you need to install. e.g. `./installer.bash ros2ez`. You can also run it interactively with no arguments. For ros-ez versions < `1.7.0`, you must use one of the `ros_*installer.bash` script. There are multiple, one for each supported ROS distribution.
* Make sure your system satisfies all the requirements. The installer script tries to remain distro-agnostic, thus does not install anything.
* Run the `installer.bash` script with a single argument with the rosez version you need to install. e.g. `./installer.bash ros2ez`. You can also run it interactively with no arguments. For ros-ez versions < `1.7.0`, you must use one of the `ros_*installer.bash` scripts. There are multiple, one for each supported ROS distribution.
* Run `. ~/.bashrc` or open a new terminal.
* Run `ros2ez` for ROS2 or `rosez` for ROS1 followed by the command you want to run else you will be thrown in a shell inside the image (useful if autocomplete is required).

Expand Down Expand Up @@ -40,6 +39,8 @@ or
* [For versions >= `v1.6.0`] A ROS2 Foxy version is now available (with the `ros2ezf` command). Its image comes with built-in `ros1_bridge` support for *ez* ROS1-ROS2 integration.
* [For versions >= `v1.6.1`] A deletion script has been included inside the `internal/deeper/` folder. It takes the version-to-delete as an argument. For example, `bash delete_version.bash ros2ezf` deletes the Foxy version for rosez.
* [For versions >= `v1.7.0`] A new script to easily create systemd services was added. It can be used interactively using `dialog` or non-interactively by passing it 9 arguments. Running the `create_rosez_systemd_service.bash` with less than 9 args (but more than 0) will trigger a help message. Additionally the installation scripts have been merged into one, `installer.bash`. You can now use it interactively, or pass a single argument with the rosez version you need to install. e.g. `./installer.bash ros2ez`
* [For versions >= `v2.0.0`] Docker devices like sound and graphics are now manually handled. This version is **NOT** the same as the previous ones. This is a pretty substantial change, thus getting a major release. Externally nothing should change for the end user, but internally a lot has changed. OSRF's `rocker` is no longer utilized, making docker handling more versatile (but also fragile).

## Tested platforms
* EndeavourOS
* Fedora 35
Expand Down
1 change: 0 additions & 1 deletion installer.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ if [[ -z "$image_name" ]]; then
done
exit -1
fi
sudo pip install rocker==0.2.10
cd $SCRIPT_DIR
need_rr=0
if ! id -nGz "$USER" | grep -qzxF "docker"
Expand Down
2 changes: 1 addition & 1 deletion internal/entrypoint.bash
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
sudo find /home/rosez_user ! -user rosez_user -execdir sudo chown rosez_user:rosez_user {} \+
source /home/rosez_user/helpers.bash
get_supported_versions
lock_file=$LOCKFILE
skip_compilation=$SKIPCOMPILATION
rosversion="unknown"
lockation=""
wstxt=""
find /home/rosez_user ! -user rosez_user -execdir sudo chown rosez_user:rosez_user {} \+
for i in $(seq 0 $(( ${#distros[@]}-1 )) ); do
if [ -f /opt/ros/"${distros[$i]}"/setup.bash ]; then
rosversion="${distros[$i]}"
Expand Down
38 changes: 23 additions & 15 deletions internal/ros2_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
FROM nvidia/opengl:1.2-glvnd-devel-ubuntu22.04 as nvidia

FROM osrf/ros:humble-desktop-full

COPY --from=nvidia /usr/local /usr/local

ENV NVIDIA_VISIBLE_DEVICES=all NVIDIA_DRIVER_CAPABILITIES=all

FROM osrf/ros:humble-desktop-full

LABEL maintainer="George Stavrinos <[email protected]>"
Expand Down Expand Up @@ -42,18 +50,18 @@ RUN addgroup --gid $GROUP_ID rosez_user && adduser --disabled-password --gecos '
USER rosez_user
RUN sudo chown -R rosez_user:rosez_user /home/rosez_user && rosdep update

VOLUME /opt/ros/humble
VOLUME /bin
VOLUME /etc
VOLUME /home
VOLUME /lib
VOLUME /lib64
VOLUME /mnt
VOLUME /opt
VOLUME /root
VOLUME /run
VOLUME /sbin
VOLUME /srv
VOLUME /sys
VOLUME /usr
VOLUME /var
VOLUME /opt/ros/humble\
/bin\
/etc\
/home\
/lib\
/lib64\
/mnt\
/opt\
/root\
/run\
/sbin\
/srv\
/sys\
/usr\
/var
38 changes: 23 additions & 15 deletions internal/ros2_foxy_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
FROM nvidia/opengl:1.2-glvnd-devel-ubuntu20.04 as nvidia

FROM osrf/ros:foxy-ros1-bridge

COPY --from=nvidia /usr/local /usr/local

ENV NVIDIA_VISIBLE_DEVICES=all NVIDIA_DRIVER_CAPABILITIES=all

FROM osrf/ros:foxy-ros1-bridge

LABEL maintainer="George Stavrinos <[email protected]>"
Expand Down Expand Up @@ -43,18 +51,18 @@ RUN addgroup --gid $GROUP_ID rosez_user && adduser --disabled-password --gecos '
USER rosez_user
RUN sudo chown -R rosez_user:rosez_user /home/rosez_user && rosdep update

VOLUME /opt/ros/foxy
VOLUME /bin
VOLUME /etc
VOLUME /home
VOLUME /lib
VOLUME /lib64
VOLUME /mnt
VOLUME /opt
VOLUME /root
VOLUME /run
VOLUME /sbin
VOLUME /srv
VOLUME /sys
VOLUME /usr
VOLUME /var
VOLUME /opt/ros/foxy\
/bin\
/etc\
/home\
/lib\
/lib64\
/mnt\
/opt\
/root\
/run\
/sbin\
/srv\
/sys\
/usr\
/var
38 changes: 23 additions & 15 deletions internal/ros_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
FROM nvidia/opengl:1.2-glvnd-devel-ubuntu20.04 as nvidia

FROM osrf/ros:noetic-desktop-full

COPY --from=nvidia /usr/local /usr/local

ENV NVIDIA_VISIBLE_DEVICES=all NVIDIA_DRIVER_CAPABILITIES=all

FROM osrf/ros:noetic-desktop-full

LABEL maintainer="George Stavrinos <[email protected]>"
Expand Down Expand Up @@ -40,18 +48,18 @@ RUN addgroup --gid $GROUP_ID rosez_user && adduser --disabled-password --gecos '
USER rosez_user
RUN sudo chown -R rosez_user:rosez_user /home/rosez_user && rosdep update

VOLUME /opt/ros/noetic
VOLUME /bin
VOLUME /etc
VOLUME /home
VOLUME /lib
VOLUME /lib64
VOLUME /mnt
VOLUME /opt
VOLUME /root
VOLUME /run
VOLUME /sbin
VOLUME /srv
VOLUME /sys
VOLUME /usr
VOLUME /var
VOLUME /opt/ros/noetic\
/bin\
/etc\
/home\
/lib\
/lib64\
/mnt\
/opt\
/root\
/run\
/sbin\
/srv\
/sys\
/usr\
/var
36 changes: 21 additions & 15 deletions internal/ros_melodic_Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
FROM nvidia/opengl:1.2-glvnd-devel-ubuntu18.04 as nvidia

FROM osrf/ros:melodic-desktop-full

COPY --from=nvidia /usr/local /usr/local

ENV NVIDIA_VISIBLE_DEVICES=all NVIDIA_DRIVER_CAPABILITIES=all

LABEL maintainer="George Stavrinos <[email protected]>"

RUN mkdir -p /opt/ros/catkin_ws/src && apt-get update && apt-get full-upgrade -y && DEBIAN_FRONTEND=noninteractive apt-get install -y \
Expand Down Expand Up @@ -40,18 +46,18 @@ RUN addgroup --gid $GROUP_ID rosez_user && adduser --disabled-password --gecos '
USER rosez_user
RUN sudo chown -R rosez_user:rosez_user /home/rosez_user && rosdep update

VOLUME /opt/ros/melodic
VOLUME /bin
VOLUME /etc
VOLUME /home
VOLUME /lib
VOLUME /lib64
VOLUME /mnt
VOLUME /opt
VOLUME /root
VOLUME /run
VOLUME /sbin
VOLUME /srv
VOLUME /sys
VOLUME /usr
VOLUME /var
VOLUME /opt/ros/melodic\
/bin\
/etc\
/home\
/lib\
/lib64\
/mnt\
/opt\
/root\
/run\
/sbin\
/srv\
/sys\
/usr\
/var
25 changes: 10 additions & 15 deletions internal/rosez_exec.bash
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ done
if [ -z "$gpu_param" ]; then
if grep -q "nvidia" <<< "$gpu_string" || grep -q "Nvidia" <<< "$gpu_string" || grep -q "NVIDIA" <<< "$gpu_string"
then
gpu_param="--nvidia"
gpu_param="--gpus all"
elif grep -q "intel" <<< "$gpu_string" || grep -q "Intel" <<< "$gpu_string" || grep -q "INTEL" <<< "$gpu_string"
then
gpu_param="--device /dev/dri/card0"
Expand Down Expand Up @@ -136,32 +136,27 @@ if [ ! -d $ssh_folder ]; then
mkdir $ssh_folder
fi
intermediate_error_handler $?
sound="--pulse"
sound="-v /run/user/$userid/pulse:/run/user/$userid/pulse --device /dev/snd -e PULSE_SERVER=unix:/run/user/$userid/pulse/native -v /run/user/$userid/pulse/native:/run/user/$userid/pulse/native"
if [ $no_sound -gt 0 ]; then
sound=""
fi
x=""$(rocker --mode dry-run --network host --x11 $sound $gpu_param --volume $rosez_vol-bin:/bin --volume $rosez_vol-etc:/etc/ --volume $rosez_vol-etc:/etc/ --volume $rosez_vol-home:/home/ --volume $rosez_vol-lib:/lib/ --volume $rosez_vol-lib64:/lib64/ --volume $rosez_vol-mnt:/mnt/ --volume $rosez_vol-opt:/opt/ --volume $rosez_vol-root:/root/ --volume $rosez_vol-run:/run/ --volume $rosez_vol-sbin:/sbin/ --volume $rosez_vol-srv:/srv/ --volume $rosez_vol-sys:/sys/ --volume $rosez_vol-usr:/usr --volume $rosez_vol-var:/var --volume $rosez_vol:/opt/ros/$ros --volume $SCRIPT_DIR/../includes/$rosws_file:/opt/ros/$rosws_file $volumes $SCRIPT_DIR/../internal/entrypoint.bash:/home/rosez_user/.bashrc --volume /dev:/dev --volume $bloom_file:/home/rosez_user/.config/bloom --volume $gitconfig_file:/home/rosez_user/.gitconfig --volume $ssh_folder:/home/rosez_user/.ssh --volume $SCRIPT_DIR/supported_versions.txt:/home/rosez_user/supported_versions.txt --volume $SCRIPT_DIR/helpers.bash:/home/rosez_user/helpers.bash --volume /:$HOME/.$rosez_vol -- $ros_image:latest | tail -n 1 | sed -e "s#-v $(pwd)/$rosez_vol#-v $rosez_vol#g")
echo $x
intermediate_error_handler $?
xauthf="$((echo \"$x\") | grep -E -o '/tmp/.docker[a-zA-Z0-9_-]+.xauth' | head -1)"
intermediate_error_handler $?
it="-it"
if [ $non_interactive -gt 0 ]; then
it=""
fi
userid=$(id -u)
xauthf="/tmp/.$ros_image-$now.xauth"
touch $xauthf
intermediate_error_handler $?
/bin/bash -c "xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $xauthf nmerge -"
intermediate_error_handler $?
cl=""
x="docker run --rm $it -u $userid --ipc=host --privileged --network host $gpu_param $sound --group-add dialout --group-add video --group-add audio -v $rosez_vol-bin:/bin -v $rosez_vol-etc:/etc/ -v $rosez_vol-etc:/etc/ -v $rosez_vol-home:/home/ -v $rosez_vol-lib:/lib/ -v $rosez_vol-lib64:/lib64/ -v $rosez_vol-mnt:/mnt/ -v $rosez_vol-opt:/opt/ -v $rosez_vol-root:/root/ -v $rosez_vol-run:/run/ -v $rosez_vol-sbin:/sbin/ -v $rosez_vol-srv:/srv/ -v $rosez_vol-sys:/sys/ -v $rosez_vol-usr:/usr -v $rosez_vol-var:/var -v $rosez_vol:/opt/ros/$ros -v $SCRIPT_DIR/../includes/$rosws_file:/opt/ros/$rosws_file $volumes -v $SCRIPT_DIR/entrypoint.bash:/home/rosez_user/.bashrc -v /dev:/dev -v $bloom_file:/home/rosez_user/.config/bloom -v $gitconfig_file:/home/rosez_user/.gitconfig -v $ssh_folder:/home/rosez_user/.ssh -v $SCRIPT_DIR/supported_versions.txt:/home/rosez_user/supported_versions.txt -v $SCRIPT_DIR/helpers.bash:/home/rosez_user/helpers.bash -v /:$HOME/.$rosez_vol -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=$xauthf -v $xauthf:$xauthf -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro $ros_image:latest"
intermediate_error_handler $?
extras="env $ENV LOCKFILE=$lock_file SKIPCOMPILATION=$skip_compilation /bin/bash"
if [ $# -gt 0 ]; then
extras=$extras" -c \"source /home/rosez_user/.bashrc && $* \""
fi
x="$x $extras"
userid=$(id -u)
groupid=$(id -g)
it="-it"
if [ $non_interactive -gt 0 ]; then
it=""
fi
x=${x/docker run --rm -it/docker run --rm $it -u $userid --ipc=host --privileged}
intermediate_error_handler $?
printf "Executing:\n---\n$x\n---\n"
eval "$x"

0 comments on commit 478c0a0

Please sign in to comment.