docker.recipes

code-server (VS Code)

beginner

VS Code in the browser.

Overview

Code-server is an open-source project developed by Coder that enables developers to run Visual Studio Code entirely within a web browser by hosting the IDE on a remote server. Originally created to solve the limitations of local development environments, code-server transforms VS Code into a web application that maintains full feature parity with the desktop version, including extensions, themes, and integrated terminal access. The project emerged from the need to provide consistent development environments across different devices and enable coding from anywhere with just a browser. This Docker deployment leverages the LinuxServer.io community image to containerize code-server with proper user permissions and configuration management. The stack mounts your project directories directly into the container while maintaining persistent configuration data, creating a portable development environment that can be deployed on any Docker-capable machine. The configuration includes password authentication and exposes the web interface on port 8443 for secure access. Developers working across multiple devices, teams requiring standardized development environments, or anyone needing to code from restricted devices like Chromebooks will find this deployment particularly valuable. Educational institutions can provide students with consistent coding environments, while remote teams can ensure everyone works with identical tooling and dependencies regardless of their local machine specifications.

Key Features

  • Complete VS Code experience running in any modern web browser
  • Extension support through Open VSX Registry with thousands of available packages
  • Built-in terminal with configurable sudo access for server administration
  • Multi-user support with individual workspaces and configurations
  • Real-time collaborative editing when combined with Live Share extensions
  • Automatic workspace persistence across container restarts
  • HTTPS support with self-signed certificates for secure remote access
  • Native file system integration with drag-and-drop upload capabilities

Common Use Cases

  • 1Remote development on powerful cloud servers while using lightweight local devices
  • 2Educational coding bootcamps providing standardized development environments for students
  • 3Development teams maintaining consistent tooling across Windows, Mac, and Linux workstations
  • 4Freelance developers working from client locations without installing local development tools
  • 5IoT and embedded development requiring direct access to target hardware over SSH
  • 6Corporate environments with locked-down workstations preventing local IDE installation
  • 7Code review sessions where multiple team members need identical project setups

Prerequisites

  • Minimum 2GB RAM allocated to Docker (4GB+ recommended for larger projects)
  • Available port 8443 on the host system for web interface access
  • Valid project directory path to mount as the workspace volume
  • Strong password set in PASSWORD environment variable for authentication
  • Docker host with sufficient disk space for project files and extensions
  • Modern web browser with JavaScript enabled and WebSocket support

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 code-server:
3 image: linuxserver/code-server:latest
4 container_name: code-server
5 restart: unless-stopped
6 environment:
7 PUID: 1000
8 PGID: 1000
9 TZ: UTC
10 PASSWORD: ${PASSWORD}
11 volumes:
12 - code_config:/config
13 - /path/to/projects:/projects
14 ports:
15 - "8443:8443"
16
17volumes:
18 code_config:

.env Template

.env
1PASSWORD=changeme

Usage Notes

  1. 1Docs: https://coder.com/docs/code-server/latest
  2. 2Access at http://localhost:8443 - login with PASSWORD env var
  3. 3Full VS Code experience in the browser
  4. 4Install extensions from Open VSX (not MS Marketplace)
  5. 5Mount /projects for your workspace files
  6. 6SUDO_PASSWORD env var enables sudo in terminal

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 code-server:
5 image: linuxserver/code-server:latest
6 container_name: code-server
7 restart: unless-stopped
8 environment:
9 PUID: 1000
10 PGID: 1000
11 TZ: UTC
12 PASSWORD: ${PASSWORD}
13 volumes:
14 - code_config:/config
15 - /path/to/projects:/projects
16 ports:
17 - "8443:8443"
18
19volumes:
20 code_config:
21EOF
22
23# 2. Create the .env file
24cat > .env << 'EOF'
25PASSWORD=changeme
26EOF
27
28# 3. Start the services
29docker compose up -d
30
31# 4. View logs
32docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/code-server/run | bash

Troubleshooting

  • Extensions fail to install: Change extension gallery URL to Open VSX instead of Microsoft Marketplace in settings
  • Permission denied accessing mounted project files: Verify PUID and PGID match your host user ID and group ID
  • Container keeps restarting: Check that port 8443 is not already in use by another service
  • Cannot access terminal or sudo commands: Set SUDO_PASSWORD environment variable to enable privileged access
  • Slow performance or timeouts: Increase allocated memory and ensure stable network connection to Docker host
  • Lost workspace settings after restart: Verify code_config volume is properly mounted and persistent

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space