diff --git a/README.md b/README.md index 919ddef2b55e73238fc9e795e38d0ebd8ed85114..3f2798a4805137d69cdb2b1ae774c1fd1e172e24 100644 --- a/README.md +++ b/README.md @@ -1,34 +1,79 @@ # ROS development environment -A set of configuration files to generate docker images for development in ROS. The aim of this project is to provide a development environment that can be used in any ROS distribution, sharing your home directory with the container. +This repo contains a set of configuration files to generate docker images for development in ROS. The aim of this project is to provide a development environment that can be used in any ROS distribution. It's not intended to be used for production purposes, only development purposes, therefore some useful configurations are considered, e.g. sharing your home directory with the container. +## Prerequisites -## Installation +A good starting point is to follow the good practices from [health robotics group](https://health_software.pages.code.tecnalia.com/software_good_practices/) and install the required packages: docker, rocker, rocker extensions, and nvidia-container-toolkit. -To use these configuration files some prerequisites must be met. +### Summary + +**Docker** ```bash -git clone git@git.code.tecnalia.com:andres.montano/development_environment.git +# First, uninstall old docker versions +for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done +# Then, install latest version of docker using apt +# Add Docker's official GPG key: +sudo apt-get update +sudo apt-get install ca-certificates curl gnupg +sudo install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +sudo chmod a+r /etc/apt/keyrings/docker.gpg + +# Add the repository to Apt sources: +echo \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null +sudo apt-get update + +# Install docker +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + +# Create the docker group. +sudo groupadd docker + +# Add your user to the docker group. +sudo usermod -aG docker $USER + +# Refresh permissions to docker group. +newgrp docker ``` -### Rocker - -[**rocker**](https://github.com/osrf/rocker) is a tool to run docker images with customized local support injected for things like nvidia video cards support. +**Rocker and Rocker extensions** -#### rocker installation +```bash +# if pipx is not installed +# for 22.04 or below +python3 -m pip install --user pipx +python3 -m pipx ensurepath + +# The installation of rocker is then reduced to: +pipx install git+https://github.com/osrf/rocker.git +pipx inject rocker git+https://github.com/sloretz/off-your-rocker.git +pipx inject rocker git+https://github.com/miguelprada/mp_rocker.git +``` +**Nvidia-container-toolkit** ```bash -sudo apt-get install python3-rocker +# Configure production repositories +curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ + && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ + sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ + sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list +# Install nvidia-container-toolkit +sudo apt-get update +sudo apt-get install -y nvidia-container-toolkit ``` -#### OYR (off-your-rocker) pluging for rocker +## Install Development Environment -[**OYR**](https://github.com/sloretz/off-your-rocker) is a plugin for rocker that allows to run docker images with extra parameteers and configurations. -In this project OYR is used to launch a docker container with a named volume, not supported by rocker. +Clone the repository: ```bash -pip3 install git+https://github.com/sloretz/off-your-rocker.git +git clone git@git.code.tecnalia.com:andres.montano/development_environment.git ``` ## Usage/Examples @@ -37,7 +82,7 @@ pip3 install git+https://github.com/sloretz/off-your-rocker.git The dockerfile allows the installation of package dependencies for the workspace these could be ROS packages or python packages, installed with apt-get or pip. Packages are defined in a requirements.txt file at ws_dependencies folder, the file name is defined by the ROS_DISTRO (e.g. ./ws_dependencies/melodic_requirements.txt). -Requirements.txt file example: +noetic_requeriments.txt file example: ```bash # APT-GET PACKAGES