Devcontainer Installation

This page explains how to set up and use a Dev Container with VS Code. It covers prerequisites, step‑by‑step usage, screenshots (placeholders included), common configuration files, and troubleshooting tips.

Overview

A Dev Container lets you develop inside a Docker container with all tools preinstalled. VS Code connects seamlessly to the container, giving you a reproducible environment for your project.

Quick Start (VS Code)

  1. Install Devcontainer Extensions in vscode

    .devcontainer folder structure


  1. Open your project in VS Code.

    cd ros2_ws/src/doosan-robot2
    code .
    

    Note

    The Open Folder path must be the parent directory of .devcontainer (don’t open the .devcontainer folder itself).

  2. Ensure your repository contains a .devcontainer/ folder with at least:

    • .devcontainer/devcontainer.json

    • (optional) .devcontainer/Dockerfile

    .devcontainer folder structure


  1. Press F1 (or Ctrl/Cmd+Shift+P) and run: Dev Containers: Reopen in Container

    Reopen in Container


  1. VS Code builds (or pulls) the image and starts the container. The first build can take some time.

    Building dev container


GUI Apps on Linux (X11)

Some GUI apps (e.g., RViz2, Gazebo) need X11 access on Linux.

Note

The Gazebo/RViz2 GUI may not appear due to missing X11 permissions (especially when using Docker or a remote session). Run the commands below once per login (and after a reboot) before launching.

xhost +                         # allow everyone; use only temporarily

These permissions reset after logout or reboot; re-apply as needed.

References