Host a Visual Studio Code Server for when you’re on the go
Do you sometimes need to program on the fly without having access to your workstation? Maybe on your phone or a friend’s computer.
Take a look at Visual Studio Code Server.
Read more information on GitHub, DockerHub and VSCode.
1. Setting it up
You need Traefik set up!
Create a new subdomain and point at your server.
Create a new directory and cd into it.
mkdir vscode && cd vscode
Then create the docker-compose.yml
nano docker-compose.yml
1.1 Installation
Paste this for your public Server, make sure to change your domain:
version: '3' services: vscode: image: linuxserver/code-server:latest container_name: vscodeserver restart: always volumes: - ./config:/config environment: - PUID=1000 - PGID=1000 - TZ=Europe/Berlin - PASSWORD=password - SUDO_PASSWORD=sudo_password networks: - web labels: - "traefik.enable=true" - "traefik.http.routers.vs-web.rule=Host(`vs.your-domain.com`)" - "traefik.http.routers.vs-web.entrypoints=web" - "traefik.http.routers.vs-web.middlewares=redirect@file" - "traefik.http.routers.vs-secured.rule=Host(`vs.your-domain.com`)" - "traefik.http.routers.vs-secured.entrypoints=web-secured" - "traefik.http.routers.vs-secured.tls.certresolver=mytlschallenge" networks: web: external: true
And now spin up the Stack:
docker-compose up -d
2. How to Use
Visit vs.your-domain.com or your chosen IP.
You’ll be greeted with this home screen:
Log in with the Password you provided.
Congratulations! You have a self-hosted Visual Studio Code Server.