-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Started on the DockerFiles #21
base: main
Are you sure you want to change the base?
Changes from 3 commits
b3df25b
7d95205
6404d8b
6cecbd3
5a50bf7
72533a3
a4739d3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Installation instructions for the DISCOWER sitl docker image! | ||
|
||
# Pre-requisites | ||
## First we install the nvidia container toolkit for gpu usage with docker | ||
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html | ||
|
||
## Then we obtain the default kasm docker image from here: https://hub.docker.com/r/kasmweb/ubuntu-jammy-desktop/tags | ||
docker pull kasmweb/ubuntu-jammy-desktop:1.14.0-rolling | ||
|
||
|
||
|
||
|
||
# Build the docker | ||
FOR NOW, use | ||
`docker build -t ff_ros2_DISCOWER -f docker_file_kasm_ubuntu_jammy .` | ||
|
||
do not use | ||
`docker build -t ff_ros2_DISCOWER -f docker_file_kasm_ubuntu_jammy_DISCOWER .` | ||
|
||
now change the id that you get in 'docker image list' (IMAGE ID) in the run_kasm_ros.sh file (line 4) | ||
|
||
## Run the setup file | ||
./run_kasm_ros.sh | ||
|
||
## GUI support | ||
open `https://127.0.0.1:10334` in your browser | ||
|
||
## Stop and Start the docker image | ||
You shouldn't have to run the `.sh` script again | ||
`docker stop ff_ros2_DISCOWER_container` | ||
`docker start ff_ros2_DISCOWER_container` | ||
and go to your browser | ||
|
||
|
||
|
||
|
||
# In the docker instance | ||
FOR NOW, run all the docker commands in `docker_file_kasm_ubuntu_jammy_DISCOWER` in the terminal (sometimes you need to use sudo, but it should all work). | ||
|
||
## Run the PX4 sim | ||
|
||
`cd ~/discower_gits/PX4-Space-Systems` | ||
`make px4_sitl gz_spacecraft_2d` | ||
|
||
## Run micro-ROS | ||
|
||
`ros2 run micro_ros_agent micro_ros_agent udp4 --port 8888` | ||
|
||
Now you should see the the /fmu/ topics being published! | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM kasmweb/ubuntu-jammy-desktop:1.14.0-rolling | ||
USER root | ||
ENV HOME /home/kasm-default-profile | ||
ENV STARTUPDIR /dockerstartup | ||
ENV INST_SCRIPTS $STARTUPDIR/install | ||
WORKDIR $HOME | ||
|
||
|
||
######### Customize Container Here ########### | ||
ARG KUH=/home/kasm-user | ||
RUN apt-get update && apt-get upgrade -y && \ | ||
apt-get install -y libomp5 && \ | ||
apt-get install -y sudo zsh && \ | ||
rm -rf /var/lib/apt/list/* && \ | ||
echo 'kasm-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ | ||
true | ||
|
||
######### End Customizations ########### | ||
|
||
|
||
RUN chown 1000:0 $HOME | ||
RUN $STARTUPDIR/set_user_permission.sh $HOME | ||
ENV HOME /home/kasm-user | ||
WORKDIR $HOME | ||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME | ||
USER 1000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
FROM kasmweb/ubuntu-jammy-desktop:1.14.0-rolling | ||
USER root | ||
|
||
#RUN rm /bin/sh && ln -s /bin/bash /bin/sh | ||
#SHELL ["/bin/bash", "-c"] | ||
|
||
ENV HOME /home/kasm-default-profile | ||
ENV STARTUPDIR /dockerstartup | ||
ENV INST_SCRIPTS $STARTUPDIR/install | ||
WORKDIR $HOME | ||
|
||
######### Customize Container Here ########### | ||
|
||
|
||
|
||
ARG KUH=/home/kasm-user | ||
RUN apt-get update && apt-get upgrade -y && \ | ||
apt-get install -y libomp5 && \ | ||
apt-get install -y sudo zsh && \ | ||
rm -rf /var/lib/apt/list/* && \ | ||
echo 'kasm-user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \ | ||
true | ||
|
||
# Cleaning up junk | ||
#RUN apt-get purge -y thunderbird* && \ | ||
# apt-get remove -y google-chrome-stable gimp zoom signal-desktop obs-studio onlyoffice-desktopeditors sublime-text && \ | ||
# apt-get autoremove -y && \ | ||
# apt-get clean | ||
|
||
#RUN rm -f /home/kasm-user/Desktop/com.obsproject.Studio.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/gimp.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/google-chrome.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/nextcloud.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/onlyoffice-desktopeditors.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/signal-desktop.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/sublime_text.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/telegram.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/Zoom.desktop && \ | ||
# rm -f /home/kasm-user/Desktop/thunderbird.desktop | ||
|
||
# Installing utilities | ||
RUN apt-get update | ||
RUN apt-get install -y terminator gedit | ||
|
||
|
||
|
||
######### | ||
# ROS 2 # | ||
######### | ||
# https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html | ||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
ENV ROS_DISTRO humble | ||
ENV ROS_PYTHON_VERSION 3 | ||
|
||
RUN add-apt-repository universe | ||
RUN apt-get update && apt install -y curl | ||
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg | ||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
software-properties-common \ | ||
build-essential \ | ||
python3-colcon-common-extensions \ | ||
python3-rosdep \ | ||
python3-vcstool \ | ||
&& rm -rf /var/lib/apt/lists* | ||
RUN rosdep init && rosdep update --rosdistro $ROS_DISTRO | ||
|
||
RUN apt-get update && apt-get install -y ros-humble-desktop | ||
|
||
RUN echo "source /opt/ros/humble/setup.bash" >> /home/kasm-user/.bashrc | ||
|
||
#RUN /bin/bash -c "source /opt/ros/humble/setup.bash && echo 'ROS2 IS SET UP'" | ||
RUN . /opt/ros/humble/setup.sh && echo ${AMENT_PREFIX_PATH} | ||
|
||
|
||
############# | ||
# Micro-ROS # | ||
############# | ||
# https://micro.ros.org/docs/tutorials/core/first_application_linux/ | ||
|
||
#RUN pip install -U rosdep colcon-common-extensions jsonschema | ||
|
||
#RUN mkdir microros_ws && cd microros_ws | ||
#RUN git clone -b humble https://github.com/micro-ROS/micro_ros_setup.git src/micro_ros_setup | ||
#RUN colcon build | ||
|
||
#RUN echo "source /home/kasm-user/microros_ws/install/local_setup.bash" >> /home/kasm-user/.bashrc | ||
#RUN source /home/kasm-user/microros_ws/install/local_setup.bash | ||
|
||
# Create firmware | ||
#RUN ros2 run micro_ros_setup create_firmware_ws.sh host | ||
#RUN ros2 run micro_ros_setup build_firmware.sh | ||
|
||
# Create mciro-ROS agent | ||
#RUN ros2 run micro_ros_setup create_agent_ws.sh | ||
#RUN ros2 run micro_ros_setup build_agent.sh | ||
|
||
|
||
|
||
################# | ||
# Gazebo Garden # | ||
################# | ||
# https://gazebosim.org/docs/garden/install_ubuntu_src | ||
|
||
#RUN echo 'export PATH="/home/kasm-user/.local/bin:${PATH}"' >> /home/kasm-user/.bashrc | ||
|
||
#RUN mkdir -p ~/gazebo_ws/src && cd ~/gazebo_ws/src | ||
#RUN wget https://raw.githubusercontent.com/gazebo-tooling/gazebodistro/master/collection-garden.yaml | ||
#RUN vcs import < collection-garden.yaml | ||
|
||
#RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg | ||
#RUN 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" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null | ||
#RUN apt-get update | ||
|
||
#RUN sudo apt -y install $(sort -u $(find . -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt' | grep -v '/\.git/') | sed '/gz\|sdf/d' | tr '\n' ' ') | ||
|
||
|
||
################## | ||
# DISCOWER stuff # | ||
################## | ||
### CUSTOM GZ-SIM | ||
#RUN pip install kconfiglib symforce pyros-genmsg future | ||
|
||
# We replace gz-sim with our DISCOWER version (for spacecraft) | ||
#RUN cd ~/gazebo_ws/src | ||
#RUN rm -rf gz-sim && git clone https://github.com/DISCOWER/gz-sim.git | ||
#RUN cd ~/gazebo_ws/src/gz-sim && git pull && git checkout origin/pr-spacecraft-thrusters | ||
#RUN cd ~/gazebo_ws && colcon build --merge-install | ||
|
||
#RUN echo "source /home/kasm-user/gazebo_ws/install/setup.bash" >> /home/kasm-user/.bashrc | ||
#RUN source /home/kasm-user/gazebo_ws/install/setup.bash | ||
|
||
### PX4-SPACE-SYSTEMS | ||
#RUN mkdir ~/discower_gits && cd ~/discower_gits | ||
#RUN git clone https://github.com/DISCOWER/PX4-Space-Systems.git | ||
|
||
### PX4_MSGS | ||
#RUN mkdir -p ~/ff_ws/src && cd ~/ff_ws/src | ||
#RUN git clone https://github.com/DISCOWER/px4_msgs.git | ||
#RUN cd ~/ff_ws && colcon build | ||
|
||
#RUN echo "source /home/kasm-user/ff_ws/install/setup.bash" >> /home/kasm-user/.bashrc | ||
|
||
# GPU enabling: | ||
# https://bugs.launchpad.net/ubuntu/+source/nvidia-prime/+bug/1948362 | ||
# RUN sudo apt install initramfs-tools && sudo prime-select nvidia | ||
|
||
|
||
|
||
######### End Customizations ########### | ||
|
||
RUN chown 1000:0 $HOME | ||
RUN $STARTUPDIR/set_user_permission.sh $HOME | ||
ENV HOME /home/kasm-user | ||
WORKDIR $HOME | ||
RUN mkdir -p $HOME && chown -R 1000:0 $HOME | ||
USER 1000 | ||
|
||
CMD ["bash"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# Configurable variables | ||
DOCKER_IMAGE=62eb1ab76978 | ||
joris997 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
WEB_PORT=10334 | ||
SSH_PORT=7901 | ||
CONTAINER_NAME=ff_ros2_DISCOWER_container | ||
VNC_PASSWORD=password | ||
# NOETIC_BASE_DIR=${HOME}/workspace/ros_noetic | ||
|
||
# Check if a container with the same name already exists | ||
if [ $(docker ps -aq -f name=^${CONTAINER_NAME}$) ]; then | ||
echo "A container with the name $CONTAINER_NAME already exists." | ||
# Choose what to do here: stop/remove the existing container, or exit | ||
# docker stop $CONTAINER_NAME | ||
# docker rm $CONTAINER_NAME | ||
# or | ||
exit 1 | ||
fi | ||
|
||
# Run the Docker container | ||
docker run -itd \ | ||
--shm-size 32g \ | ||
--runtime=nvidia \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this mean that we have to have an nvidia gpu? Probably just check whether it exists before running it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good point. I will take this into account There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added a check for the existence of the nvidia-smi command. |
||
--gpus all\ | ||
--privileged \ | ||
-p $WEB_PORT:6901 \ | ||
-p $SSH_PORT:22 \ | ||
--security-opt seccomp=unconfined \ | ||
-e VNC_PW=$VNC_PASSWORD \ | ||
-e NVIDIA_DRIVER_CAPABILITIES=all \ | ||
--name $CONTAINER_NAME \ | ||
$DOCKER_IMAGE | ||
#--volume="${NOETIC_BASE_DIR}:/home/kasm-user/workspace:Z" \ | ||
|
||
# Check if Docker run was successful | ||
if [ $? -eq 0 ]; then | ||
echo "Container $CONTAINER_NAME started successfully." | ||
else | ||
echo "Failed to start the container." | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth using kasm if there is so much stuff that is not needed? We are pulling and then deleting stuff again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this @joris997 , is it possible to trim their original docker so that it doesn't install all this by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using kasm for the simple browser GUI support. In a command above, I mention that there is a clean jammy docker with kasm:
https://hub.docker.com/r/kasmweb/core-ubuntu-jammy
but I haven't had time to test what will break w.r.t. the installation instructions.
I'm not that familiar with docker, so if there is a more lightweight option to get browser GUI support (or you want to go forward with another interface method), then let me know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best approach would be start barebone and include only the necessary dependencies. This helps a) to identify dependencies so you can maintain them b) decrease the size of the docker, so you can save resources. This is not only on your local system, but has a huge impact when running CI.
If you are overwhelmed by this, PX4 already has a container maintained which includes a minimum set of dependencies: https://github.com/PX4/PX4-containers This may not be the minimum, but quite close.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that provide a VNC instance ? Joris showed it running next to me and it seems convinient to just open the browser and have a desktop environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it doesn't have one we can add it 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would indeed be a nicer and lightweight solution. I will look into it this week @Jaeyoung-Lim