Run VS Code on Linux, in a container or just anywhere–work in a browser image 34

Run VS Code on Linux, in a container or just anywhere–work in a browser

My colleague pointed the open source code-server project to me. This project allows you to run Visual Studio Code just anywhere – and to develop on any device.

He already had it running – showing off his code development skills on a mobile phone. Of course I had to try it out for myself. And the steps are very simple. As is demonstrated below. My environment is in this case is Ubuntu 20.4 running in Windows 10 WSL2. I also tried to several other environments, including a Docker container.

The steps (on a Linux environment)

Git Clone the code-server from GitHub:

git clone https://github.com/cdr/code-server

First run to print out the install process:

curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run

image

Now to actually install:

curl -fsSL https://code-server.dev/install.sh | sh

The install script will print out how to run and start using code-server.

image

Now we easily start the Visual Code Server using this command:

code-server

image

When the server has started, Visual Source Code can be opened in the browser using the URL: http://127.0.0.1:8080

image

The password required can be found in the file that has been generated on the server: ~/.config/code-server/config.yml

image

Paste the password into the field and click Submit:

image

The browser opens with the VS Code editor:

image

When files and folders are opened in VS Code, these are opened from the server’s file system. Here for example is the code-server’s own config.yaml opened:

image

The code-server project also publishes a Docker Container Image that can also be used to run the Code Server. 

image

Resources

Code Server on GitHub – https://github.com/cdr/code-server