# Docker installation using the convenience script
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Post-install steps for Docker
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
# Verify Docker
docker run hello-worldNote: Log out and log back in may be required for the group changes to take effect.
# Configure the 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 \
&& \
sudo apt-get update
# Install the NVIDIA Container Toolkit packages
sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
# Configure the container runtime
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
# Verify NVIDIA Container Toolkit
docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smiThe provided Dockerfile builds containers with the following specifications:
- ROS1-User Container:
- Based on
nvidia/cuda:11.8.0-devel-ubuntu20.04, which includes:- CUDA 11.8 development environment
- Ubuntu 20.04 as the base operating system
- Graphics Support:
- Preconfigured with
OpenGLand theVulkan SDKfor hardware-accelerated rendering and simulation.
- Preconfigured with
- ROS 1 Noetic:
- suitable for robotics applications on Ubuntu 20.04
- Python Environment:
- Installs Miniconda3 for Python package management and environment isolation.
- Configures the environment with the conda-forge channel and strict channel priority.
- Dynamic User Environment:
- Creates a non-root development user with sudo privileges
- Uses
Zshas the default shell, withOh My Zshpre-installed for a modern CLI experience - Source the ROS 1 setup script to ensure ROS 1 environment variables are available in the shell
- Source the catkin workspace setup script to ensure the workspace is properly configured
- Activate the conda environment
~/code/.envon shell startup
- Entrypoint:
- Maps the host's
$UIDand$GIDto the container's user and group IDs, allowing for seamless file permission management between the host and the container.
- Maps the host's
- Based on
Below shell will generate the .env file, create the binding directories, and create the docker-compose.yaml file.
bash docker/generate_env.sh- Build the image
irvlutd/ubuntu20.04-cuda-11.8.0-ros-noetic:latest:
bash docker/container_handler.sh build ros1-user- Ensure the image is built successfully by running:
docker images
# You should see the image `irvlutd/ubuntu20.04-cuda-11.8.0-ros-noetic` in the list