code-server is the open-source project that runs full VS Code including extensions, integrated terminal, Git, IntelliSense — on a remote server, accessible from any browser. This guide deploys it on Ubuntu 24.04 with Docker Compose, fronted by Traefik for automatic HTTPS.
Prerequisites: an Ubuntu 24.04 server (1GB RAM / 2 vCPU minimum), a domain A record (e.g.
code.example.com), Docker and Docker Compose installed.
Set Up the Project
$ mkdir -p ~/vscode-server/{project,config,local,letsencrypt}
$ cd ~/vscode-server
-
project— your editable workspace -
config— code-server settings/extensions -
local— user-specific data -
letsencrypt— Traefik's ACME certificate storage
Find your UID/GID and add yourself to the docker group:
$ id $USER
$ sudo usermod -aG docker $USER
Write the Compose File
$ nano docker-compose.yml
services:
code-server:
image: codercom/code-server:latest
container_name: code-server
user: "UID:GID" # Replace with your user's UID and GID
environment:
- PASSWORD=SECURE_PASSWORD # Replace with a strong password
- DOCKER_USER=LINUXUSER # Replace with your username
volumes:
- ./project:/home/coder/project
- ./config:/home/coder/.config
- ./local:/home/coder/.local
networks:
- internal
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.code-server.rule=Host(`CODE.EXAMPLE.COM`)" # Replace with your domain name
- "traefik.http.routers.code-server.entrypoints=websecure"
- "traefik.http.routers.code-server.tls.certresolver=myresolver"
- "traefik.http.services.code-server.loadbalancer.server.port=8080"
traefik:
image: traefik:latest
container_name: traefik
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./letsencrypt:/letsencrypt
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=internal"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=ADMIN@EXAMPLE.COM" # Replace with your email
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
networks:
- internal
restart: unless-stopped
networks:
internal:
Replace UID:GID, SECURE_PASSWORD, CODE.EXAMPLE.COM, ADMIN@EXAMPLE.COM, and LINUXUSER with your actual values.
What's happening:
- code-server runs as your host UID/GID (avoids bind-mount permission issues), keeps port 8080 internal-only, and carries Traefik labels routing your domain to it over HTTPS.
- traefik listens on 80/443, gets certs via the ACME HTTP-01 challenge, discovers code-server through Docker labels, and force-redirects HTTP to HTTPS.
- internal network — a private Docker network so Traefik can reach code-server without exposing its port to the host.
Start It
$ docker compose up -d
$ docker compose ps
Visit https://code.example.com, enter your password — you should land on the code-server home page.
Next Steps
code-server is running with automatic HTTPS via Traefik. From here:
- Install VS Code extensions directly from within the browser UI — they persist in the
configvolume - Mount additional project directories as needed for multiple workspaces
- Put code-server behind an auth proxy (e.g. Authelia) if you want SSO instead of the single shared password
For the full guide, visit the original article on Vultr Docs.
Top comments (0)