|
| 1 | +#.. redirect-from:: |
| 2 | +# |
| 3 | +# Deploying-ROS2-on-IBM-Cloud |
| 4 | +# Tutorials/Deploying-ROS-2-on-IBM-Cloud |
| 5 | + |
| 6 | +ROS2 Rust Docker Environment |
| 7 | +========================================================= |
| 8 | + |
| 9 | +This folder contains scripts to build, start, and interact with a Docker container for a ROS2 Rust environment. |
| 10 | + |
| 11 | +.. contents:: Table of Contents |
| 12 | + :depth: 3 |
| 13 | + :local: |
| 14 | + |
| 15 | +Prerequisites |
| 16 | +------------- |
| 17 | + |
| 18 | +Ensure you have the following installed on your system: |
| 19 | + |
| 20 | +- `Docker <https://docs.docker.com/engine/install/>`__ |
| 21 | +- Permissions to run Docker commands (sudo may be required on some systems). |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +Files in the Folder |
| 26 | +------------------- |
| 27 | + |
| 28 | +- `build.sh <./build.sh>`_: Builds the Docker image. |
| 29 | +- `start.sh <./start.sh>`_: Starts the Docker container. |
| 30 | +- `shell.sh <./shell.sh>`_: Accesses the running container |
| 31 | + |
| 32 | + |
| 33 | +Steps to Use |
| 34 | +------------ |
| 35 | + |
| 36 | +1. Build the Docker Image |
| 37 | +~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 38 | + |
| 39 | +Run the ``build.sh`` script to build the Docker image: |
| 40 | + |
| 41 | +.. code-block:: bash |
| 42 | +
|
| 43 | + $ ./build.sh |
| 44 | +
|
| 45 | +This script: |
| 46 | + |
| 47 | +- Builds a Docker image named ``ros2_rust:latest``. |
| 48 | +- Uses ``BUILDKIT`` for efficient caching and builds. |
| 49 | + |
| 50 | + |
| 51 | +2. Start the Docker Container |
| 52 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 53 | +Run the ``start.sh`` script to start the container: |
| 54 | + |
| 55 | +.. code-block:: bash |
| 56 | +
|
| 57 | + $ ./start.sh |
| 58 | +
|
| 59 | +This script: |
| 60 | + |
| 61 | +- Checks if a container based on the ros2_rust image exists and removes it if necessary. |
| 62 | +- Starts a new container named ros2_rust with the following settings: |
| 63 | + - **Interactive mode** (``-it``). |
| 64 | + - **User ID Mapping**: Maps the current user (ID ``1000``) to the container user cuser. |
| 65 | + - **Privileges**: Grants ``sudo`` group membership and system capabilities (e.g., sys_nice). |
| 66 | + - **Networking**: Uses the host's network stack. |
| 67 | + - **X11 Forwarding**: Allows graphical applications to be displayed on the host system. |
| 68 | + |
| 69 | + |
| 70 | +3. Access the Running Container |
| 71 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 72 | +Run the ``shell.sh`` script to open an interactive shell in the running container: |
| 73 | + |
| 74 | +.. code-block:: bash |
| 75 | +
|
| 76 | + $ ./shell.sh |
| 77 | +
|
| 78 | +This script: |
| 79 | + |
| 80 | +- Opens a Bash shell as the user ``cuser``. |
| 81 | +- Sets the working directory to ``/home/cuser/workspace``. |
| 82 | + |
| 83 | + |
| 84 | +4. Install ros2 rust packages |
| 85 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 86 | + |
| 87 | +Follow the `README.md <../README.md>`_ file to install the overall packages needed to start working with ROS2 and Rust. |
| 88 | + |
| 89 | + |
| 90 | +Notes |
| 91 | +----- |
| 92 | +- If you encounter permission issues with X11, ensure the host system is configured to allow access in each terminal: |
| 93 | + |
| 94 | +.. code-block:: bash |
| 95 | +
|
| 96 | + $ xhost local:root |
0 commit comments