Container environment variables
These variables are automatically set when the container starts.ROS2 variables
ROS_DISTRO
- Value:
jazzy - Set in: Dockerfile
.devcontainer/Dockerfile:4 - Purpose: Specifies the ROS2 distribution version
- Usage: Used by ROS2 tools to locate packages and configurations
ROS_DOMAIN_ID
- Value:
30 - Set in:
devcontainer.json:51 - Purpose: Network isolation for ROS2 nodes
- Range: 0-232
- Usage: Prevents interference between multiple ROS2 systems on the same network
If you’re running multiple ROS2 systems on the same network, use different domain IDs (e.g., 30, 31, 32) to keep them isolated.
RMW_IMPLEMENTATION
- Value:
rmw_cyclonedds_cpp - Set in:
devcontainer.json:53 - Purpose: ROS2 middleware implementation (DDS)
- Options:
rmw_cyclonedds_cpp,rmw_fastrtps_cpp - Usage: CycloneDDS provides better performance for simulation workloads
TurtleBot3 variables
TURTLEBOT3_MODEL
- Value:
burger(default) - Set in:
devcontainer.json:52 - Purpose: Specifies which TurtleBot3 model to use
- Options:
burger,waffle,waffle_pi - Usage: Launch files read this to spawn the correct robot model
Gazebo variables
GZ_VERSION
- Value:
harmonic - Set in:
devcontainer.json:54andDockerfile:5 - Purpose: Specifies Gazebo version
- Usage: Ensures compatibility between ROS2 Jazzy and Gazebo Harmonic
Display variables
DISPLAY
- Value:
:1 - Set in:
devcontainer.json:50 - Purpose: X11 display server for GUI applications
- Usage: Routes GUI windows to the VNC server
If GUI applications (Gazebo, RViz) don’t appear in VNC, verify
DISPLAY is set to :1.QT_QPA_PLATFORM
- Value:
xcb - Set in:
devcontainer.json:55 - Purpose: Qt platform plugin for GUI rendering
- Usage: Required for RViz2 and other Qt-based tools
Graphics variables
LIBGL_ALWAYS_SOFTWARE
- Value:
0(default, uses hardware acceleration if available) - Set in:
devcontainer.json:56with fallback from host - Purpose: Force software rendering for OpenGL
- Options:
0(hardware),1(software) - Usage: Fallback when GPU acceleration isn’t available or causes issues
.devcontainer/post-create.sh:47-53) automatically enables software rendering if no GPU is detected:
Workspace variables
These are set in your.bashrc by the post-create script.
Complete bashrc configuration
From.devcontainer/post-create.sh:29-44:
Modifying environment variables
Temporary change (current session)
Set for the current terminal session only:Permanent change (all sessions)
Option 1: Edit devcontainer.json (recommended)
Edit.devcontainer/devcontainer.json and rebuild:
F1 → Dev Containers: Rebuild Container
Option 2: Edit bashrc
Add to~/.bashrc:
Verifying environment
Check all critical variables:.devcontainer/verify-setup.sh:92-119).
Common customizations
Use different DDS implementation
Isolate from other ROS2 systems
Force software rendering
.devcontainer/post-create.sh:68-71:
Troubleshooting
Variable not set
Symptom:echo $VARIABLE returns empty
Solution:
Variables reset after reopening terminal
Symptom: Variables work in one terminal but not in new ones Solution: Add the export to~/.bashrc to make it permanent, or set in devcontainer.json and rebuild.
ROS2 nodes can’t communicate
Symptom: Topics don’t appear, nodes are isolated Solution: Verify all terminals use the sameROS_DOMAIN_ID: