How-To Develop Using VSCode with Your Remote Server over SSH

How-To Develop Using VSCode with Your Remote Server over SSH

As many people are working from home (WFH) due to Covid-19, still able to develop your software,  ... with your remote machine or server could be very challenging. Today, I just found Remote Development with VS Code and the plugin Remote-SSH.

It works very WELL and fit my needs as I am building some stuffs inside a docker running at ClearLinux server. In addition, I am also managing some docker containers running inside other ClearLinux box for HomeLab stuff.

In the past, I thought I could do just use NFS share to edit source code and still need to SSH to server to build or run some docker commands.

The Remote - SSH extension lets you open folders or workspaces hosted on any remote machine, VM, or container with a running SSH server. Development over SSH lets you:

  • Develop on larger, faster, or more specialized hardware than your local machine.
  • Quickly swap between different, remote development environments and safely make updates without worrying about impacting your local machine.
  • Debug an application running somewhere else, such as a customer site or in the cloud.

Look at below picture which I am doing building my router OpenWrt image:

  • I can browse the source code as it is located locally (my server is next to my PC)
  • I can open the terminal which apear to be the remote side shell – WOW.
Remote-SSH VSCode screen

Below are steps you need to do to config remote-ssh:

  1. Install Remote-SSH plugin to VSCode
  2. Configure remote server via Remote-SSH:Add New SSH Host
  3. Connect to your remote SSH host: Remote-SSH:Connect to Host, then chose the folder you want to work with.

For more information, please see the Developing using SSH documentation.

From now, I don't need to using any local docker container, just do it inside my ClearLinux VM running inside my server R720XD.

You can discover more How-Tos series.

Good luck!