This repository contains easy to use commands for generating custom docker images for ROS/ROS2. The images are not based from the official ROS/ROS2 images so as to allow for further customization, such as CUDA or L4T support.
- Docker images and commands for ROS/ROS2 Development
- Installation for TE3003B class
First, install the docker engine on your host machine. The installation instructions can be found here. Warning: On Ubuntu, install docker desktop at own risk. It may cause issues with the host machine's network settings given it uses a virtual machine with its own network configuration.
Add your user to the docker group to avoid using sudo for docker commands:
sudo usermod -aG docker $USERThen, log out and log back in so that your group membership is re-evaluated. This repository has not been tested on machines without sudo access on the docker group.
If you are using a GPU, install the NVIDIA Container Toolkit. The installation instructions can be found here.
A regular Jetpack installation should be enough to run the containers without major issues. Follor the docker post-installation steps to allow the docker daemon to run without sudo. If problems arise when using graphical applications, run the following command to give your user permission to the video group:
sudo usermod -aG video $USERRestart your bash session or the Jetson to apply changes. Check dustynv repository for further information on running the containers and on Jetpack versions compatibility.
Clone the repository to your local machine:
git clone https://github.com/EmilianoHFlores/ros-docker
cd ros-dockerEach ROS2 image has corresponding Makefile commands for easy execution. First, start at repo directory and run the build command:
cd ros-docker
make te3003.build # No CUDA support
make te3003.build.cuda # With CUDA support
make te3003.build.l4t<l4t-version> # No CUDA supportThen, run the run command for creating the container:
make te3003.create # No CUDA support
make te3003.create.cuda # With CUDA support
make te3003.create.l4t<l4t-version> # No CUDA supportFinally, run the start command for starting the container and entering the shell:
make te3003.up # Start container
make te3003.shell # Enter container terminalThe makefile containes further commands to delete containers:
make te3003.down # Stop container
make te3003.remove # Remove containermake te3003.build
make te3003.createmake te3003.build.cuda
make te3003.create.cudaThe docker run commands mount selected folders for easy access to the host machine files. Files to mount are called as arguments to the make commands. For example, to mount a directory "ros-workspace" in the repository folder to the container, run the following command:
make te3003.create volumes="ros-workspace"Similarly, to mount multiple directories, separate them with a comma:
make te3003.create volumes="ros-workspace,~/other-folder,/home/user/Documents/another-folder"Any folder mounted from the host machine will be available in the container at the /workspace directory, where the container starts.
Default names for containers are "ros-". This name is shared between cuda and non-cuda containers. When creating the name of the container may be edited by setting the "name" variable:
make te3003.create name="my-container" # no volume
make te3003.create name="my-container" volumes="ros-workspace" # with volumeConsider that docker commands on this container must be run manually, including exec, stop, and remove commands. Remember to include user on docker exec:
docker exec -it --user $(shell id -u):$(shell id -g) my-container bashCUDA images are available in different versions and types. Versions compatible may vary for your system and the docker Ubuntu version. For compatibility, only 11.8 and 12.1 are accepted, defaulting to 11.8. Image type can be set to "runtime" to include only capability to run CUDA compiled code, while "devel" and "cudnn" images allow for CUDA code compilation and cuDNN support, respectively. Check available images at the NVIDIA CUDA Docker Hub and follow the prompt in the run script to set the desired image.
make te3003.build.cuda cuda-image="runtime" cuda-version="11.8" # DefaultBy default, Humble containers will default to image "runtime" and version "11.8" if no argument is given.
The docker containers are set to use the host network and display, as well as devices such as the webcam. On the run scripts at docker/scripts, these settings may be edited.
The necessary commands to run can be summarized as:
make te3003.build.cuda # remove cuda if necessary
make te3003.create.cuda volumes="~/my_working_folder" # mount a folder you want to work on
make te3003.up # start the container, should not be necessary after create but will be on system reboot
make te3003.shell