Skip to content

Commit 27ed0a1

Browse files
Add devcontainer README.rst
1 parent a0bc22e commit 27ed0a1

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.devcontainer/README.rst

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#.. redirect-from::
2+
#
3+
# Deploying-ROS2-on-IBM-Cloud
4+
# Tutorials/Deploying-ROS-2-on-IBM-Cloud
5+
6+
Development Container for ROS2 Rust
7+
====================================
8+
9+
This repository includes a pre-configured development container setup, designed to facilitate working on ROS2 Rust projects. The setup is managed using Visual Studio Code's DevContainers feature.
10+
11+
.. contents:: Table of Contents
12+
:depth: 3
13+
:local:
14+
15+
File Description
16+
----------------
17+
18+
The provided ``devcontainer.json`` file specifies the configuration for running a containerized development environment with the following features:
19+
20+
- **Image Configuration**: Uses the Docker image ros2_rust_dev:latest.
21+
- **Build Settings**:
22+
- Context: Specifies the root directory of the project (``..``).
23+
- Dockerfile: Uses the Dockerfile located at ``../docker/Dockerfile``.
24+
- Build Args: Includes runtime environment variables such as ``XDG_RUNTIME_DIR``.
25+
- **Workspace**:
26+
- Mounts the folder ``/home/cuser/workspace`` as the development workspace.
27+
- **Container Runtime**:
28+
- Enables ``--network=host`` for network sharing.
29+
- Grants privileged access using ``--privileged``.
30+
- **Environment Variables**:
31+
- ``DISPLAY`` and ``TERM`` are forwarded from the host to the container to support GUI applications and terminal colors.
32+
- **User Settings**:
33+
- The development container runs as the user ``cuser``.
34+
- Configures the shell to use ``/bin/bash`` for a familiar and customizable command-line experience.
35+
36+
Setting Up and Running the DevContainer in VS Code
37+
--------------------------------------------------
38+
39+
To use this development container in Visual Studio Code, follow these steps:
40+
41+
Prerequisites
42+
~~~~~~~~~~~~~
43+
44+
1. **Install VS Code**: Download and install `Visual Studio Code <https://code.visualstudio.com/>`__.
45+
46+
2. **Install Required Extensions:**
47+
- `Remote Containers <https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers>`__
48+
3. **Install Docker:** Ensure Docker is installed and running on your system. You can download Docker from `here <https://www.docker.com/>`__.
49+
50+
51+
Steps to Launch the DevContainer
52+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53+
54+
1. **Clone the Repository**: Clone your project repository to your local machine.
55+
56+
.. code-block:: bash
57+
58+
$ git clone [email protected]:ros2-rust/ros2_rust.git
59+
$ cd ros2_rust
60+
61+
62+
63+
2. **Open in VS Code**: Open the repository folder in VS Code.
64+
65+
.. code-block:: bash
66+
67+
$ code .
68+
69+
3. **Open the Command Palette**: Press ``Ctrl+Shift+P`` (Windows/Linux) or ``Cmd+Shift+P`` (macOS) to open the Command Palette.
70+
4. **Reopen in Container**: Search for and select **"Dev Containers: Reopen in Container"**. VS Code will build and start the development container based on the configuration in ``devcontainer.json``.
71+
5. **Start Coding**: Once the container is running, your workspace is ready for development. You can open terminals, run commands, and debug your ROS2 Rust projects seamlessly within the containerized environment.
72+
73+
Notes
74+
~~~~~
75+
76+
- **Container Network**: The ``--network=host`` option is enabled to allow network sharing between the host and container.
77+
- **Privilege**: The ``--privileged`` flag is enabled, which may be required for specific ROS2 features but should be used cautiously.
78+
- If you encounter permission issues with X11, ensure the host system is configured to allow access in each terminal:
79+
80+
.. code-block:: bash
81+
82+
$ xhost local:root
83+
$ code &

0 commit comments

Comments
 (0)