The RoboTerrain Dockerfile provides a fully self-contained, reproducible environment built on top ofDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jackvice/RoboTerrain/llms.txt
Use this file to discover all available pages before exploring further.
osrf/ros:humble-desktop (Ubuntu 22.04). Inside the image you get ROS 2 Humble full desktop, Nav2, Gazebo Fortress via the ros-humble-ros-gz meta-package, PyTorch with CUDA 11.8 support, Stable Baselines3 with extras, and the entire ros2_ws workspace pre-built — so you can jump straight to running experiments without managing system dependencies on your host machine.
Prerequisites
Before building or running the container, ensure the following are installed and configured on your host:- Docker Engine — version 20.10 or later. Install via the official Docker documentation.
-
NVIDIA Container Toolkit (
nvidia-container-toolkit) — required to expose your GPU inside the container. Follow the NVIDIA installation guide and verify with: - NVIDIA drivers — CUDA 11.8 inside the container requires host driver version ≥ 520 on the host machine.
Build the Image
From the root of the cloned repository (where theDockerfile lives), build the image and tag it as roboterrain:
- Pull
osrf/ros:humble-desktopas the base layer - Install OpenGL libraries needed for Gazebo rendering
- Install ROS 2 Humble full desktop, Nav2, and all control packages via
apt - Install Gazebo Fortress and the ROS ↔ Gazebo bridge
- Install PyTorch (CUDA 11.8),
gym==0.23.1, and Stable Baselines3 viapip3 - Copy the
ros2_ws/src/directory into/home/ros2_ws/srcand runcolcon build
apt or pip steps change.
Run the Container
Headless GPU Training (Recommended)
For running RL training jobs without a display, no X11 setup is required:With Gazebo GUI (X11 Forwarding)
To view the Gazebo Fortress viewport from inside the container, pass your host X11 socket into the container:.bashrc), so you can immediately run:
What’s Included
The following packages and libraries are installed inside the image: ROS 2 Humble packages (viaapt)
ros-humble-desktop-full— Full ROS 2 desktop with RViz, rqt, and all standard middlewareros-humble-navigation2— Nav2 navigation stackros-humble-nav2-bringup— Nav2 launch and configuration filesros-humble-ros2-control— ROS 2 control frameworkros-humble-ros2-controllers— Standard controller implementations (diff-drive, joint-state broadcaster, etc.)ros-humble-diff-drive-controller— Differential drive controller pluginros-humble-joint-state-broadcaster— Joint state publisher for Gazebo integrationros-humble-xacro— Macro language for URDF/SDF robot descriptionsros-humble-ros-gz— Gazebo Fortress ↔ ROS 2 meta-packageros-humble-ros-gz-sim— Gazebo simulation bridgeros-humble-gazebo-ros2-control— Gazebo hardware interface forros2_control
pip3, installed in the Dockerfile)
torch,torchvision,torchaudio— PyTorch with CUDA 11.8 (--extra-index-url https://download.pytorch.org/whl/cu118)gym==0.23.1— OpenAI Gym, pinned for SB3 API compatibilitystable-baselines3[extra]— SB3 with TensorBoard, OpenCV, and Hugging Face Hub extrasnumpy,scipy— Scientific computing foundations
apt)
libgl1-mesa-glx,libgl1-mesa-dri,libglvnd-dev,mesa-utils— OpenGL libraries required for Gazebo 3D rendering
The
requirements.txt file in the repository root lists transforms3d, stable-baselines3[extra], and jax for use in native (non-Docker) installations. The Dockerfile installs gym==0.23.1, stable-baselines3[extra], numpy, and scipy directly via pip3. If you need transforms3d or jax inside the container, install them manually after starting the container: pip3 install transforms3d jax.Working Directory
The Dockerfile setsWORKDIR /home/ros2_ws before copying and building the workspace. All paths inside the container are relative to this directory:
/home/ros2_ws/install/setup.bash via the container’s .bashrc and entrypoint.
Exposed Ports
The Dockerfile exposes the following ports. Map them with-p <host>:<container> when you need to connect external tools:
| Port | Service | Example use |
|---|---|---|
11311 | ROS master / DDS discovery | Connect external ROS 2 nodes running on the host |
11345 | Gazebo server | Access Gazebo via the Ignition transport network from the host |
Environment Variables
The following environment variables are set in the image and inherited by all processes inside the container:| Variable | Value | Purpose |
|---|---|---|
LANG | C.UTF-8 | Sets the system locale for correct UTF-8 text handling |
LC_ALL | C.UTF-8 | Overrides all locale categories to UTF-8 |
DEBIAN_FRONTEND | noninteractive | Prevents apt from prompting for user input during the build |
PATH | /opt/ros/humble/bin:$PATH | Ensures ROS 2 CLI tools (ros2, colcon) are on the path |
~/.bashrc inside the container also sources both the ROS 2 underlay and the built workspace overlay automatically on every interactive shell start: