Run NVIDIA Isaac Sim in a Docker container with ROS2 Humble and ROS2 bridge already set up.
I work with Ubuntu 24.04.1 LTS and I found that NVIDIA Isaac Sim isn't running on it yet. Thus, I had to dockerize it over an ubuntu 22.04 image. Furthermore, I wanted to build an image with ROS2 Humble installed and the ROS2 bridge for Isaac Sim too.
Consequently, I share the Dockerfile in this repository. I hope it helps you!
In order to build the image, you can either follow the steps manually or run the bash script build.sh
. Make sure to meet all the prerrequisites.
In order to run the container, you can run it manually as shown below or run the bash script run.sh
.
This repository has been run with the following host specifications:
OS: Ubuntu 24.04.1 LTS
*
RAM: 32 GB
Processor: 13th Gen Intel® Core™ i7-13650HX × 20
Graphics card: NVIDIA GeForce RTX 4060 Laptop GPU
Graphics card memory: 8 GB
Needed disk space: 22 GB
*It should work in previous releases as 20.04 and 22.04.
- NVIDIA Drivers installation: https://ubuntu.com/server/docs/nvidia-drivers-installation
GPU drivers version must be 535.129.03 or later, check it with:
nvidia-smi
- Docker installation and executing without sudo:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Post-install steps for Docker
sudo groupadd docker # Create group
sudo usermod -aG docker $USER # Add current user to docker group
newgrp docker # Log in docker group
#Verify Docker installation
docker run hello-world
- NVIDIA Container Toolkit installation:
# 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-smi
- Generate NGC API Key: https://docs.nvidia.com/ngc/ngc-overview/index.html#generating-api-key
- Log in to NGC:
docker login nvcr.io
Username: $oauthtoken
Password: <Your NGC API Key>
WARNING! Your password will be stored unencrypted in /home/username/.docker/config.json.
Configure a credential helper to remove this warning. See
credentials-store
Login Succeeded
4.2.0
ROS2 Humble Desktop
Client: Docker Engine - Community
Version: 27.3.1
API version: 1.47
Go version: go1.22.7
Git commit: ce12230
Built: Fri Sep 20 11:40:59 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 27.3.1
API version: 1.47 (minimum version 1.24)
Go version: go1.22.7
Git commit: 41ca978
Built: Fri Sep 20 11:40:59 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.22
GitCommit: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
runc:
Version: 1.1.14
GitCommit: v1.1.14-0-g2c9f560
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker build -t {IMAGE_NAME}:{TAG} .
Example:
docker build -t isaac_sim_ros2:4.2.0-Humble .
Allow running graphic interfaces in the container:
xhost +
Run the container with the needed configuration:
docker run --name isaac-sim --entrypoint bash -it --gpus all -e "ACCEPT_EULA=Y" --rm --network=host -e "PRIVACY_CONSENT=Y" -v $HOME/.Xauthority:/root/.Xauthority -e DISPLAY -v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache:rw -v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw -v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw -v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw -v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw -v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw -v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw -v ~/docker/isaac-sim/documents:/root/Documents:rw isaac_sim_ros2:4.2.0-Humble
REMEMBER: if you want to share a folder between the host and the container, mount it adding the next flag to the previous command:
-v HOST_PATH:PATH_IN_CONTAINER
-v ~/Documents/isaac_sim/PROJECT_ID:~/PROJECT_ID
If this command is included when running the container, ROS2 bridge will fail. That's because the container with ROS2 packages must be started first, and then Isaac Sim. Once the container is running, type next line in the container:
./runapp.sh
Wait until Isaac Sim is completely loaded. Ignore "not responding" messages, it will take some time, so be patient ;).
Add execution permissions:
chmod u+x build.sh run.sh
Build:
./build.sh
Run:
./run.sh
https://docs.omniverse.nvidia.com/isaacsim/latest/installation/install_container.html
https://catalog.ngc.nvidia.com/orgs/nvidia/containers/isaac-sim