---
title: "Deploy code-server"
description: "VS Code in the browser with a persistent home and password"
category: "Other"
url: https://railway.com/deploy/deploy-code-server-vs-code-in-browser
---

# Deploy code-server

VS Code in the browser with a persistent home and password

**[Deploy code-server on Railway](https://railway.com/template/deploy-code-server-vs-code-in-browser)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/deploy-code-server-vs-code-in-browser/manifest.json

- **Creator:** onepush
- **Category:** Other
- **Total deploys:** 1

## Template content

### code-server

- **Image:** codercom/code-server:4.141.0@sha256:72ab24b5680ee597dd647b30d82625752f40109b5f61bef90ffbf1ea1f02dbb8
- **Start command:** `/bin/sh -c 'set -e; W="${DEFAULT_WORKSPACE:-/home/coder/workspace}"; if [ "$(stat -c %u /home/coder)" != 1000 ]; then cp -an /etc/skel/. /home/coder/; chown -R 1000:1000 /home/coder; echo "volume: /home/coder handed to coder (uid 1000)"; fi; runuser -u coder -- mkdir -p "$W" "${ENTRYPOINTD:-/home/coder/.entrypoint.d}"; exec runuser -u coder -- /usr/bin/entrypoint.sh --bind-addr 0.0.0.0:8080 --disable-telemetry --enable-remote-storage "$W"'`
- **Health check:** /healthz
- **Public domain:** Yes

## Documentation

# Deploy and Host self hosted code-server (VS Code in the Browser) on Railway

This template runs the official codercom/code-server 4.141.0 image on one Railway service: VS Code in the browser, on a volume, behind a generated password. Scripts in .entrypoint.d reinstall toolchains on every boot. It suits one developer, not a team.

## About Hosting code-server open-source software on Railway (self hosted code-server template)

This template runs the official codercom/code-server 4.141.0 image as a single service, with the whole home directory on a Railway volume at /home/coder. Your projects, settings, extensions and shell history stay yours and survive redeploys.

## Why Deploy code-server, the GitHub Codespaces alternative on Railway (Railway Free Trial)

Codespaces bills per core-hour and you rent someone else's machine. Here the codercom/code-server 4.141.0 image runs as your own service with a volume at /home/coder, so the workspace survives redeploys, and you pay flat Railway usage. Start on the $5 trial.

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying code-server on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

### Railway vs Other Hosting Providers and VPS for code-server self hosting

Railway wires the volume, health check and boot scripts for you; the other three hand you a server and a blank stare.

| Provider | What You Get with Railway | What You Get with the Other Provider |
| --- | --- | --- |
| DigitalOcean | Service plus /home/coder volume and generated password | Droplet, separate block volume, Caddy for TLS |
| AWS | Same service, no security group or load balancer to manage | EC2, mounted EBS volume, security group, ALB for TLS |
| Hetzner | Flat cost, volume and boot scripts already wired | Cheapest RAM, but you own firewall, proxy and upgrades |

Hetzner wins on raw price; Railway wins on time to a working editor.

## Common Use Cases for hosted code-server

- **iPad and Chromebook coding:** Open the public domain, paste the password, and keep working in the same /home/coder/workspace you left on your laptop.
- **Away-from-desk fixes:** Patch a config, rerun the test suite, and push a hotfix from a borrowed machine without installing Node or VS Code locally.
- **Learning and teaching:** Students get a full editor and terminal behind one password, with their files and extensions intact between sessions.
- **Throwaway experiments:** Clone a repo, break it, and redeploy; the volume keeps projects and settings while apt packages reset on the next boot.
- **Always-on side projects:** Keep a small service and its dev server running, then preview it through /proxy/3000/ on the same domain and login.

## Dependencies for code-server Docker hosted on Railway

code-server on Railway is one service built from the official codercom/code-server 4.141.0 image, so there is no Dockerfile to maintain. The moving parts are a public port on 8080, a volume at /home/coder, and the variables below.

### Deployment Dependencies for Managed code-server Service (Browser IDE)

- **Image:** codercom/code-server:4.141.0 (VS Code 1.141.0, released 2026-10-08), pinned by tag and digest, no custom build.
- **Port:** 8080, public. Health check at /healthz, unauthenticated, timeout 120 s. Restart policy ALWAYS.
- **Volume:** mounted at /home/coder, the whole home directory.
- **PASSWORD:** generated per deploy, 32 random alphanumeric characters.
- **PORT:** 8080. **DEFAULT_WORKSPACE:** /home/coder/workspace.
- **ENTRYPOINTD:** /home/coder/.entrypoint.d. **RAILWAY_RUN_UID:** 0.

### Implementation Details for code-server (Using the official codercom/code-server 4.141.0 image)

The container boots as root only long enough to hand the root-owned volume to the coder user (uid 1000), seed .bashrc and .profile from /etc/skel, then drops privileges with runuser and runs the upstream entrypoint with --bind-addr 0.0.0.0:8080 --disable-telemetry --enable-remote-storage.

## How does code-server compare against other cloud development environments

Same editor in all four cases. What differs is who owns the machine, how you pay, and what survives a restart.

### code-server vs GitHub Codespaces (GitHub Codespaces Alternative)

- **Billing:** Codespaces charges per core-hour plus storage; Railway stays flat whether you code ten minutes or ten hours.
- **Ownership:** The container, sudo and toolchains are yours; Codespaces machines get recycled when you stop them.
- **Where Codespaces wins:** Zero setup, tight GitHub integration, and a free monthly quota for light personal use.

### code-server vs Gitpod (Gitpod Alternative)

- **Persistence:** /home/coder survives redeploys, so settings, extensions and ~/.ssh stay put; Gitpod rebuilds from config.
- **Cost shape:** Flat infrastructure spend instead of usage-based billing that follows your hours.
- **Where Gitpod wins:** Ephemeral, reproducible workspaces per branch, with prebuilds for teams.

### code-server vs Coder (Coder Alternative)

- **Scope:** Coder provisions many team workspaces from a control plane; this is one service, one user, one password.
- **Effort:** No Kubernetes or template directory. Deploy the image and log in.
- **Where Coder wins:** Multi-user governance, quotas and templates across a large engineering org.

### code-server vs Replit (Replit Alternative)

- **Editor:** Full VS Code with Open VSX extensions, not a browser-native editor with a subset of features.
- **Runtime:** You control the container, apt packages and language versions; Replit picks the environment.
- **Where Replit wins:** Instant hosting, AI helpers and share links without touching a Dockerfile or volume.

## How to use code-server (VS Code in your browser)?

1. Open the public domain Railway assigned and paste PASSWORD from the service's Variables tab. Login is rate-limited, so a wrong paste costs you a retry. Change it later by editing PASSWORD and redeploying.
2. You land in /home/coder/workspace. Clone a repo there, not in /tmp; only /home/coder survives a redeploy.
3. Install extensions from Open VSX, then restart the service once to confirm they persist.
4. Add a script named tools.sh under /home/coder/.entrypoint.d, chmod +x it, and apt installs rerun as the coder user on every boot.
5. Preview a dev server listening on port 3000 at https://your-domain/proxy/3000/ behind the same login. Open editors follow you across devices because remote storage is on.

## How to self host code-server on other VPS Services (code-server self hosting guide)

### Clone the Repository

Nothing to clone: the project ships an install script and an official image. Pull the pinned tag:

```bash
docker pull codercom/code-server:4.141.0
```

### Install Dependencies

You need Docker (or Node 20+ if you skip containers), plus Caddy or nginx in front for TLS and WebSockets.

### Configure Environment Variables

Set PASSWORD and the bind address, or write the config file at ~/.config/code-server/config.yaml:

```yaml
bind-addr: 0.0.0.0:8080
auth: password
password: change-me
```

### Start the code-server Application

```bash
docker run -d --name code-server -p 8080:8080 \
  -e PASSWORD=change-me -v code-home:/home/coder \
  codercom/code-server:4.141.0 --bind-addr 0.0.0.0:8080
```

Point your reverse proxy at port 8080, open your-domain, and paste the password. Railway handles the volume, TLS, password and restarts for you, so you can skip all of this.

## Official Pricing of code-server (code-server pricing)

code-server itself is free. Coder, the company, also sells a separate enterprise platform for provisioning many team workspaces; that isn't required here. Scale RAM up and the cost moves with it; the software stays free.

## code-server vs GitHub Codespaces cost comparison (Pricing, features, costs, and more)

### Monthly cost of self hosting code-server on Railway

One always-on code-server runs about $5-15/mo on Railway at light to moderate use, depending on RAM. Codespaces bills per core-hour of compute plus storage, with a free monthly quota for personal accounts, so cost tracks hours. code-server itself is MIT and free.

### System Requirements for Hosting code-server on a VPS

1-2 GB RAM is comfortable for VS Code plus language servers; large TypeScript or Java projects want more. Add disk for the /home/coder volume, which holds projects, extensions and toolchains, and put HTTPS in front.

## Frequently Asked Questions (FAQs)

### Where do I find the password?

Open the code-server service in Railway, go to the Variables tab and copy PASSWORD, then paste it on the login page. Edit PASSWORD and redeploy to change it.

### What persists across redeploys?

Everything under /home/coder: workspace projects, settings.json, keybindings, extensions, config.yaml, shell history, ~/.ssh and toolchains installed in home. The container filesystem does not persist.

### How do I install apt packages that survive a redeploy?

Write the install commands into an executable script in /home/coder/.entrypoint.d (chmod +x) and they run as coder on every boot. Hand-installed apt packages vanish on redeploy.

### Does code-server work on an iPad or Chromebook?

Yes. Safari or Chrome, log in, and you get the editor, terminal and git. Remote storage keeps workbench state on the server, so open editors follow you between devices.

### How do extensions work with Open VSX?

code-server pulls from Open VSX because the Microsoft marketplace is licensed for Microsoft products. Most popular extensions are there; install the rest from a .vsix file.

### How do I preview a dev server on port 3000?

Run it in a terminal, then open https://your-domain/proxy/3000/ behind the same login. Port 8080 stays the editor.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/deploy-code-server-vs-code-in-browser
