Ruan Bekker's Blog

From a Curious mind to Posts on Github

Running vs Code in Your Browser With Docker

vscode

Say Thanks! Slack Status Chat on Slack GitHub followers

Today we will setup a Visual Studio Code instance running on Docker, so that you can access VSCode via the web browser.

VSCode in Docker

The work directory will be under code and the application will store its data under data. Lets go ahead and create them:

1
2
mkdir demo/{code,data}
cd demo

Run the vscode container:

1
2
3
4
$ docker run --rm --name vscode \
  -it -p 8443:8443 -p 8888:8888 \
  -v $(pwd)/data:/data -v $(pwd)/code:/code \
ruanbekker/vscode:python-3.7

The password that you require on login will be prompted in the output:

1
2
3
4
5
6
7
8
9
10
11
INFO  code-server v1.1156-vsc1.33.1
INFO  Additional documentation: http://github.com/cdr/code-server
INFO  Initializing {"data-dir":"/data","extensions-dir":"/data/extensions","working-dir":"/code","log-dir":"/root/.cache/code-server/logs/20190914105631217"}
INFO  Starting shared process [1/5]...
INFO  Starting webserver... {"host":"0.0.0.0","port":8443}
INFO
INFO  Password: 4b050c4fa0ef109d53c10d9f
INFO
INFO  Started (click the link below to open):
INFO  https://localhost:8443/
INFO  Connected to shared process

Access vscode on https://localhost:8443/ and after you accepted the self-signed certificate warning, you will be presented with the login page:

image

After you have logged a example of creating a python file will look like this:

image

The source code for this docker image can be found at https://github.com/ruanbekker/dockerfiles/tree/master/vscode .

Different versions

Currently I have only python available on docker hub with the requests and flask packages available. But you can fork the repository and add the upstream or packages of your choice.

-->

Comments