RTRoboticsTools.in

ROS 2 Devcontainer Generator

Answer a few questions and download a VS Code dev container for your ROS 2 project. It works the same on Linux, Windows and macOS: open the folder, click Reopen in Container, and you have ROS 2, your dependencies and working RViz / Gazebo windows, with nothing installed on your machine except Docker.

How to use the ROS 2 Devcontainer Generator

  1. 1Choose your computer’s operating system and a ROS 2 version.
  2. 2Say whether your repo is a whole workspace or a single package, then pick what you need: GUI apps, Nav2, MoveIt, Gazebo.
  3. 3Download the .zip, open the folder in VS Code and click “Reopen in Container”.

Which computer will you develop on?

ROS 2 runs in the same Linux container everywhere. This decides how it reaches your screen and network.

Live preview: updates as you choose

.devcontainer/devcontainer.json

// ROS 2 dev container, generated by roboticstools.in
{
  "name": "ROS 2 Jazzy Jalisco",
  "build": {
    "dockerfile": "Dockerfile"
  },
  "remoteUser": "ros",
  "workspaceMount": "source=${localWorkspaceFolder},target=/home/ros/ros2_ws,type=bind",
  "workspaceFolder": "/home/ros/ros2_ws",
  "runArgs": [
    "--network=host",
    "--ipc=host"
  ],
  "mounts": [
    "source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind"
  ],
  "containerEnv": {
    "DISPLAY": "${localEnv:DISPLAY}",
    "QT_X11_NO_MITSHM": "1"
  },
  "initializeCommand": "xhost +local: >/dev/null 2>&1 || true",
  "postCreateCommand": "bash .devcontainer/post-create.sh",
  "customizations": {
    "vscode": {
      "extensions": [
        "ranch-hand-robotics.rde-pack",
        "ms-vscode.cpptools-extension-pack",
        "ms-python.python",
        "redhat.vscode-xml",
        "redhat.vscode-yaml"
      ],
      "settings": {
        "terminal.integrated.defaultProfile.linux": "bash",
        "python.analysis.extraPaths": [
          "/opt/ros/jazzy/lib/python3.12/site-packages",
          "/opt/ros/jazzy/local/lib/python3.12/dist-packages"
        ],
        "C_Cpp.default.includePath": [
          "/opt/ros/jazzy/include/**",
          "${workspaceFolder}/**"
        ]
      }
    }
  }
}