- Published on
Running VS Code in your Browser with Docker
- Authors
- Name
- Ruan Bekker
- @ruanbekker
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:
mkdir demo/{code,data}
cd demo
Run the vscode container:
$ 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:
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:
After you have logged a example of creating a python file will look like this:
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.
Thank You
Thanks for reading, if you like my content, feel free to check out my website, and subscribe to my newsletter or follow me at @ruanbekker on Twitter.
- Linktree: https://go.ruan.dev/links
- Patreon: https://go.ruan.dev/patreon