Skip to content

Commit 2d24cf5

Browse files
Update Setup-ROS-2-with-VSCode-and-Docker-Container.rst (ros2#3363) (ros2#3364)
* Update Setup-ROS-2-with-VSCode-and-Docker-Container.rst Fixed some minor issues and get the $DISPLAY variable from the system in devcontainer.json to open RViz 2. Co-authored-by: Chris Lalancette <[email protected]> (cherry picked from commit 360b5c4) Co-authored-by: Mario Niedermeyer <[email protected]>
1 parent 7095ef1 commit 2d24cf5

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

source/How-To-Guides/Setup-ROS-2-with-VSCode-and-Docker-Container.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The workspace structure should look like this:
105105
└── package2
106106

107107

108-
Open the ``src`` folder of your workspace in VS Code.
108+
With ``File->Open Folder...`` or ``Ctrl+K Ctrl+O``, open the ``src`` folder of your workspace in VS Code.
109109

110110
Edit devcontainer.json for your environment
111111
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -120,7 +120,7 @@ Therefore add the following to ``.devcontainer/devcontainer.json``:
120120
"privileged": true,
121121
"remoteUser": "USERNAME",
122122
"build": {
123-
"dockerfile": "DOCKERFILE",
123+
"dockerfile": "Dockerfile",
124124
"args": {
125125
"USERNAME": "USERNAME"
126126
}
@@ -145,7 +145,8 @@ Therefore add the following to ``.devcontainer/devcontainer.json``:
145145
"ROS_DOMAIN_ID": "42"
146146
},
147147
"runArgs": [
148-
"--net=host"
148+
"--net=host",
149+
"-e", "DISPLAY=${env:DISPLAY}"
149150
],
150151
"mounts": [
151152
"source=/tmp/.X11-unix,target=/tmp/.X11-unix,type=bind,consistency=cached",
@@ -200,7 +201,7 @@ Open the Dockerfile and add the following contents:
200201
USER $USERNAME
201202
CMD ["/bin/bash"]
202203
203-
Search here also for the ``USERNAME`` and replace it with your ``Linux username`` and the ROS_DISTRO with the ROS 2 distribution you wish to use and added to the cache previously.
204+
Search here also for the ``USERNAME`` and replace it with your ``Linux username`` and the ``ROS_DISTRO`` with the ROS 2 distribution you wish to use and added to the cache previously.
204205

205206

206207
Open and Build Development Container
@@ -214,11 +215,12 @@ This will build your development docker container for your. It will take a while
214215
Test Container
215216
^^^^^^^^^^^^^^
216217

217-
To test if everything worked correctly, open a terminal in the container using ``Terminal->New Terminal`` in VS Code.
218+
To test if everything worked correctly, open a terminal in the container using ``View->Terminal`` or ``Ctrl+Shift+``` and ``New Terminal`` in VS Code.
218219
Inside the terminal do the following:
219220

220221
.. code-block:: console
221222
223+
sudo apt install ros-$ROS_DISTRO-rviz2 -y
222224
source /opt/ros/$ROS_DISTRO/setup.bash
223225
rviz2
224226

0 commit comments

Comments
 (0)