Remote development vscode: Difference between revisions

From RidgeRun Developer Wiki
No edit summary
No edit summary
Line 9: Line 9:
[[File:vs_square.png]]
[[File:vs_square.png]]


Click that icon then, "Connect to host..." -> "+ Add new ssh host" -> then input the ssh connection string, i.e. ssh user@host -A, input the password if needed. you should be able to open any folder in the target and a terminal.
Click that icon then, "Connect to host..." -> "+ Add new ssh host" -> then input the ssh connection string, i.e. ssh user@host -A, input the password if needed, you should be able to open any folder in the target and a terminal.


=Inception=
=Inception=

Revision as of 21:33, 20 May 2022

Introduction

This page shows how to use vscode to develop remotely on a target using ssh or in a docker container.

Steps

Install the remote development extension for vscode https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack This extension includes support for ssh and docker, although, separate extensions for each exist.

Once installed a green icon will appear on the lower left corner of the window.

Click that icon then, "Connect to host..." -> "+ Add new ssh host" -> then input the ssh connection string, i.e. ssh user@host -A, input the password if needed, you should be able to open any folder in the target and a terminal.

Inception

Sometimes you may need to connect to a remote server, which has a docker container in it. Interestingly enough, you can use vscode to connect to the server, and then inside the server, attach vscode to the running container

To do it, click on the green icon, which now should indicate that you are connected to the target via ssh.

Then, click on attach to running container:

Now select the running container you want to attach to. You should see something like the following.

Of course you could also attach to a local container in your PC.