Info
Updated the docker container with dependencies needed for RoboSub
Nekton Docker
Dockerfile
Dockerfile# Stage 1: Build opencv FROM --platform=$TARGETARCH ubuntu:22.04 AS builder ARG TARGETARCH ENV DEBIAN_FRONTEND=noninteractive ENV TZ=America/New_York RUN mkdir /opencv # install python packages, wget and unzip RUN apt-get update && apt-get install --no-install-recommends -y \ python3-dev python3-pip python3-numpy wget unzip # install build dependencies RUN apt-get update && apt-get install --no-install-recommends -y \ build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev \ libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev \ libtiff-dev libdc1394-dev protobuf-compiler libgflags-dev libgoogle-glog-dev \ libblas-dev libhdf5-serial-dev liblmdb-dev libleveldb-dev liblapack-dev libsnappy-dev \ libprotobuf-dev libopenblas-dev libgtk2.0-dev libboost-dev libboost-all-dev libeigen3-dev \ libatlas-base-dev # install ARM only dependency RUN if [ "${TARGETARCH}" == "arm64" ]; then apt-get install --no-install-recommends -y libne10-10 libne10-dev; fi RUN pip3 install neon RUN apt-get update && apt-get install --no-install-recommends -y \ libneon27-dev RUN apt-get install --no-install-recommends -y libneon27-gnutls-dev # download opencv to the tmp directory WORKDIR /tmp/ RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/4.6.0.zip RUN wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.6.0.zip RUN unzip opencv.zip; unzip opencv_contrib.zip; mv opencv-4.6.0 opencv; mv opencv_contrib-4.6.0 opencv_contrib # generate neon variable RUN if [ "${TARGETARCH}" == "arm64" ]; then export USE_NEON=ON; else export USE_NEON=OFF; fi # configure installation options to build and install to /opencv RUN mkdir opencv/build WORKDIR /tmp/opencv/build RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/opencv \ -D ENABLE_NEON="${USE_NEON}" \ -D ENABLE_TBB=ON \ -D ENABLE_IPP=ON \ -D ENABLE_VFVP3=ON \ -D WITH_OPENMP=ON \ -D WITH_CSTRIPES=ON \ -D WITH_OPENCL=ON \ -D BUILD_NEW_PYTHON_SUPPORT=ON \ -D BUILD_opencv_python3=ON \ -D HAVE_opencv_python3=ON \ -D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \ -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib/modules ..; # build opencv RUN make -j4 # install the built files RUN make install # Stage 2: set up runtime container FROM --platform=$TARGETARCH tiryoh/ros2-desktop-vnc:humble ENV ROS_DISTRO=humble ENV GZ_VERSION=garden SHELL ["/bin/bash", "-c"] # Uninstall the old version of Gazebo RUN apt-get update && apt-get purge ros-humble-gazebo-ros-pkgs ros-humble-ros-ign -y || true && apt autoremove -y # Install Gazebo Garden RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \ && apt-get update \ && apt-get install gz-garden --no-install-recommends -y # Prepare to build ros_gz from source RUN mkdir -p /opt/ros_gz_ws/src && cd /opt/ros_gz_ws && git clone --branch humble https://github.com/gazebosim/ros_gz.git ./src # Install ros_gz dependencies RUN rosdep install -r --from-paths /opt/ros_gz_ws/ -i -y --rosdistro humble # Build ros_gz RUN cd /opt/ros_gz_ws/ && source /opt/ros/humble/setup.bash && colcon build --packages-up-to ros_gz # Copy over opencv installation COPY --from=builder /opencv /opencv RUN cp -r /opencv/lib/python3.10/dist-packages/cv2/ /opt/ros/humble/lib/python3.10/site-packages/cv2 RUN ldconfig /opencv # set user to root USER root ENV USER=root \ HOME=/root # install runtime opencv dependencies, vim, gedit, and xacro RUN apt-get update && apt-get install --no-install-recommends -y \ libgoogle-glog-dev python3-dev python3-pip python3-numpy vim \ gedit ros-humble-xacro ros-humble-rosbridge-suite # set up ros workspace RUN mkdir /nekton_ws \ && mkdir /nekton_ws/src WORKDIR /root # configure desktop file # make user desktop directory RUN mkdir -p /root/Desktop/ # fix desktop permissions issue RUN sed -i 's@Exec=/usr/bin/caja@Exec=/usr/bin/caja --force-desktop@g' /usr/share/applications/caja.desktop # set up bashrc RUN echo "git config --global --add safe.directory /nekton_ws/src/NektonSoftware;" >> /root/.bashrc \ && echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc \ && echo "source /opt/ros_gz_ws/install/setup.bash" >> /root/.bashrc \ && echo "alias setup='cd /nekton_ws; apt update; rosdep install --from-paths . --ignore-src -y; colcon build';" >> /root/.bashrc \ && echo "alias src='cd /nekton_ws; source ./install/setup.bash';" >> /root/.bashrc \ && echo "alias build='cd /nekton_ws; colcon build; src;'" >> /root/.bashrc \ && echo "alias launch='src; ros2 launch nekton_bringup test.launch';" >> /root/.bashrc \ && echo "cd /nekton_ws;" >> /root/.bashrc
RoboSub (Competition) Docker
Dockerfile
Dockerfile updates
- Extra runtime dependencies (tmux,
nano,robot_localization)- Extra ROS packages (
ros-humble-tf-transformations,ros-humble-plotjuggler-ros)- Python dependency (
transforms3d)- Updated ROS GPG Key step
New
Dockerfile# Stage 1: Build opencv FROM --platform=$TARGETARCH ubuntu:22.04 AS builder ARG TARGETARCH ENV DEBIAN_FRONTEND=noninteractive ENV TZ=America/New_York RUN mkdir /opencv # install python packages, wget and unzip RUN apt-get update && apt-get install --no-install-recommends -y \ python3-dev python3-pip python3-numpy wget unzip # install build dependencies RUN apt-get update && apt-get install --no-install-recommends -y \ build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev \ libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev \ libtiff-dev libdc1394-dev protobuf-compiler libgflags-dev libgoogle-glog-dev \ libblas-dev libhdf5-serial-dev liblmdb-dev libleveldb-dev liblapack-dev libsnappy-dev \ libprotobuf-dev libopenblas-dev libgtk2.0-dev libboost-dev libboost-all-dev libeigen3-dev \ libatlas-base-dev # install ARM only dependency RUN if [ "${TARGETARCH}" == "arm64" ]; then apt-get install --no-install-recommends -y libne10-10 libne10-dev; fi RUN pip3 install neon RUN apt-get update && apt-get install --no-install-recommends -y \ libneon27-dev RUN apt-get install --no-install-recommends -y libneon27-gnutls-dev # download opencv to the tmp directory WORKDIR /tmp/ RUN wget -O opencv.zip https://github.com/opencv/opencv/archive/4.6.0.zip RUN wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.6.0.zip RUN unzip opencv.zip; unzip opencv_contrib.zip; mv opencv-4.6.0 opencv; mv opencv_contrib-4.6.0 opencv_contrib # generate neon variable RUN if [ "${TARGETARCH}" == "arm64" ]; then export USE_NEON=ON; else export USE_NEON=OFF; fi # configure installation options to build and install to /opencv RUN mkdir opencv/build WORKDIR /tmp/opencv/build RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/opencv \ -D ENABLE_NEON="${USE_NEON}" \ -D ENABLE_TBB=ON \ -D ENABLE_IPP=ON \ -D ENABLE_VFVP3=ON \ -D WITH_OPENMP=ON \ -D WITH_CSTRIPES=ON \ -D WITH_OPENCL=ON \ -D BUILD_NEW_PYTHON_SUPPORT=ON \ -D BUILD_opencv_python3=ON \ -D HAVE_opencv_python3=ON \ -D PYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \ -D OPENCV_EXTRA_MODULES_PATH=/tmp/opencv_contrib/modules ..; # build opencv RUN make -j4 # install the built files RUN make install # Stage 2: set up runtime container FROM --platform=$TARGETARCH tiryoh/ros2-desktop-vnc:humble ENV ROS_DISTRO=humble ENV GZ_VERSION=garden SHELL ["/bin/bash", "-c"] # Uninstall the old version of Gazebo RUN apt-get update && apt-get purge ros-humble-gazebo-ros-pkgs ros-humble-ros-ign -y || true && apt autoremove -y # Install Gazebo Garden RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg \ && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null \ && apt-get update \ && apt-get install gz-garden --no-install-recommends -y # Prepare to build ros_gz from source RUN mkdir -p /opt/ros_gz_ws/src && cd /opt/ros_gz_ws && git clone --branch humble https://github.com/gazebosim/ros_gz.git ./src # Install ros_gz dependencies RUN rosdep install -r --from-paths /opt/ros_gz_ws/ -i -y --rosdistro humble # Build ros_gz RUN cd /opt/ros_gz_ws/ && source /opt/ros/humble/setup.bash && colcon build --packages-up-to ros_gz # Copy over opencv installation COPY --from=builder /opencv /opencv RUN cp -r /opencv/lib/python3.10/dist-packages/cv2/ /opt/ros/humble/lib/python3.10/site-packages/cv2 RUN ldconfig /opencv # set user to root USER root ENV USER=root \ HOME=/root # Add updated ROS GPG key manually RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg # install runtime opencv dependencies, editors, ROS tools, and requested packages RUN apt-get update && apt-get install --no-install-recommends -y \ libgoogle-glog-dev python3-dev python3-pip python3-numpy \ vim gedit nano tmux \ ros-humble-xacro ros-humble-rosbridge-suite \ ros-humble-robot-localization \ ros-humble-tf-transformations \ ros-humble-plotjuggler-ros \ pip install transforms3d # # set up ros workspace # RUN mkdir /nekton_ws \ # && mkdir /nekton_ws/src # # Set up mrg workspace RUN mkdir -p /mrg_ws/src # Set working directory WORKDIR /root # configure desktop file # make user desktop directory RUN mkdir -p /root/Desktop/ # fix desktop permissions issue RUN sed -i 's@Exec=/usr/bin/caja@Exec=/usr/bin/caja --force-desktop@g' /usr/share/applications/caja.desktop # # set up bashrc # RUN echo "git config --global --add safe.directory /nekton_ws/src/NektonSoftware;" >> /root/.bashrc \ # && echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc \ # && echo "source /opt/ros_gz_ws/install/setup.bash" >> /root/.bashrc \ # && echo "alias setup='cd /nekton_ws; apt update; rosdep install --from-paths . --ignore-src -y; colcon build';" >> /root/.bashrc \ # && echo "alias src='cd /nekton_ws; source ./install/setup.bash';" >> /root/.bashrc \ # && echo "alias build='cd /nekton_ws; colcon build; src;'" >> /root/.bashrc \ # && echo "alias launch='src; ros2 launch nekton_bringup test.launch';" >> /root/.bashrc \ # && echo "cd /nekton_ws;" >> /root/.bashrc # set up bashrc RUN echo "git config --global --add safe.directory /mrg_ws;" >> /root/.bashrc \ && echo "source /opt/ros/humble/setup.bash" >> /root/.bashrc \ && echo "source /opt/ros_gz_ws/install/setup.bash" >> /root/.bashrc \ && echo "alias setup='cd /mrg_ws; apt update; rosdep install --from-paths . --ignore-src -y; colcon build';" >> /root/.bashrc \ && echo "alias src='cd /mrg_ws; source ./install/setup.bash';" >> /root/.bashrc \ && echo "alias build='cd /mrg_ws; colcon build; src;'" >> /root/.bashrc \ && echo "alias launch='src; ros2 launch nekton_bringup test.launch';" >> /root/.bashrc \ && echo "cd /mrg_ws;" >> /root/.bashrc
Docker Compose
https://docs.docker.com/compose/
docker-compose.yml--- version: "2" services: nekton: # image: mwoodward6/nekton:humble image: mwoodward6/mrg:humble container_name: nekton environment: - DISPLAY=:1.0 - USER=root volumes: # Replace <PATH_GOES_HERE> with the path to NektonSoftware (If you cloned it to your home directory in WSL this would be ~/NektonSoftware) # - <PATH_GOES_HERE>:/nekton_ws/src/NektonSoftware - ~/mrg/mrg_ws:/mrg_ws - ~/bin:/root/bin ports: - 6080:80 - 5900:5900 - 9090:9090 - 8080:8080 - 8765:8765 # Exposes Foxglove Bridge WebSocket tty: true restart: unless-stopped




