This guide explains how to set up a Docker-based development environment for building and developing Dave repository and related software.
Follow these steps to install the required utilities on your host system.
Running Docker is more trustworthy if you are not so familiar with installation process. If you choose to use the container-based installation instructions, the following are required:
Run the following command to uninstall all conflicting packages:
for pkg in [docker.io](<http://docker.io/>) docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
apt-get
might report that you have none of these packages installed.(Docker Install Method 1) Install using the apt
repository
Set up Docker's apt
repository:
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL <https://download.docker.com/linux/ubuntu/gpg> -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \\
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] <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 the Docker packages (latest version):
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify that the Docker Engine installation is successful by running the hello-world
image:
sudo service docker start
sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits.
Sample Output:
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
<https://hub.docker.com/>
For more examples and ideas, visit:
<https://docs.docker.com/get-started/>
Make sure to also complete the Linux post-install instructions linked at the bottom of the page.
sudo groupadd docker sudo usermod -aG docker $USER newgrp docker # You may now run docker without sudo docker run hello-world
(Docker Install Method 2) Docker Desktop
Meet the system requirements.
Note: The latest Ubuntu 24.04 LTS is not yet supported. Docker Desktop will fail to start. Due to a change in how the latest Ubuntu release restricts the unprivileged namespaces,
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
needs to be run at least once.
For non-Gnome Desktop environments, gnome-terminal
must be installed:
sudo apt install gnome-terminal
Set up Docker's package repository as mentioned here.
Download latest DEB package.
Install the package with apt as follows:
sudo apt-get update
sudo apt-get install ./docker-desktop-<version>-<arch>.deb
At the end of the installation process,
apt
displays an error due to installing a downloaded package. You can ignore this error message.N: Download is performed unsandboxed as root, as file '/home/user/Downloads/docker-desktop.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
There are a few post-install configuration steps done through the post-install script contained in the deb package.
<aside> 💡 If you don’t have external discrete GPU and to use internal GPU, skip this part
</aside>
nvidia-container-toolkit (installation instructions)
Configure the production repository:
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
Optionally, configure the repository to use experimental packages:
sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
Update the packages list from the repository:
sudo apt-get update
Install the NVIDIA Container Toolkit packages:
sudo apt-get install -y nvidia-container-toolkit
Configure the container runtime by using the nvidia-ctk
command:
sudo nvidia-ctk runtime configure --runtime=docker
The nvidia-ctk
command modifies the /etc/docker/daemon.json
file on the host. The file is updated so that Docker can use the NVIDIA Container Runtime.
Restart the Docker daemon:
sudo systemctl restart docker
Running a sample workload:
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
Your output should resemble the following output:
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.78 Driver Version: 550.78 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 3070 ... Off | 00000000:01:00.0 On | N/A |
| N/A 46C P8 23W / 125W | 700MiB / 8192MiB | 3% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+
Check Dockwater prerequisites NVIDIA driver versions to see which NVIDIA driver versions are supported for your system Ubuntu versions.
Tested and verified with the Docker installation method on the following system configurations:
<aside> ℹ️ Please follow these steps to install Rocker on Ubuntu 24.04
</aside>
Set-up virtual python environment for rocker installation
# Python virtual environment and package manager installation
sudo apt update
sudo apt install -y python3-pip python3-venv git
# Make or Choose a directory for dave workspace
# here, populating dave_ws directory at user's home
mkdir -p ~/dave_ws/src && cd ~/dave_ws
# Make python virtual environment with python3-venv
python3 -m venv dave_venv
# Set-up virtual environment (terminal will now show dave_venv)
source dave_venv/bin/activate
# Install VCS tool in virtual environment
pip install vcstool
(dave_venv)
your terminal showing that you are in the virtual environmentCopy dave source codes and install rocker in virtual environment
cd ~/dave_ws/src && curl -fsSL <https://raw.githubusercontent.com/IOES-Lab/dave/ros2/extras/repos/dave.jazzy.repos> | vcs import --skip-existing --shallow --input -