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 for post
Image for post

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 for post
Image for post

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

code-server
Image for post
Image for post

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

Image for post
Image for post

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

Image for post
Image for post

Paste the password into the field and click Submit:

Image for post
Image for post

The browser opens with the VS Code editor:

Image for post
Image for post

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 for post
Image for post

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

Image for post
Image for post

Resources

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

Originally published at https://technology.amis.nl on September 22, 2020.

Written by

Lucas Jellema is solution architect and CTO at AMIS, The Netherlands. He is Oracle ACE Director, Groundbreaker Ambassador, JavaOne Rockstar and programmer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store