_desktopdocs
guide

Self-hosting and security

Run desktops on your own Docker host and connect privately over SSH.

Launch on your server

On a server you manage with Docker and Node.js 20 or newer, clone the repository and launch a named desktop with fixed host ports:

sh
git clone https://github.com/tanav29/desktop.git
cd desktop
node desktop-cli.mjs new --name research --api-port 8095 --vnc-port 6080 --cpus 2 --memory 3g

The launcher publishes both services on the server's loopback interface. Save the printed bearer token and noVNC password in your secret store. For each additional desktop on the same host, use a unique name and a different pair of ports, or let Docker pick free ports.

Connect over SSH

From the machine where your agent or browser runs, forward both ports. Replace user@your-server with your SSH login:

sh
ssh -N -o ExitOnForwardFailure=yes -L 127.0.0.1:18095:127.0.0.1:8095 -L 127.0.0.1:16080:127.0.0.1:6080 user@your-server

Leave the SSH session running. Open http://127.0.0.1:16080/vnc.html and enter the viewer password. Configure the agent to use http://127.0.0.1:18095 and supply the bearer token through its secret configuration. Check the desktop's name with:

sh
curl http://127.0.0.1:18095/api/identity

SSH encrypts the connection to the server. The daemon and viewer themselves serve plain HTTP on loopback. Files written to /workspace stay on the Docker host. Retrieve them separately over SSH if you need a local copy.

What the credentials protect

ControlBehavior
API bearer tokenRequired for desktop actions, shell commands, screen capture, and other protected requests. The root instructions, health, and identity can be read without it.
noVNC passwordSeparate credential for viewing and operating the desktop in a browser.
Per-desktop workspace and limitsEach named container has its own workspace by default and independent CPU and memory caps.

The API token grants full access to its container. Shell commands run as root inside it, and Chromium runs with its sandbox disabled. Use a trusted host and trusted agents. Keep both ports off the public internet, mount only task-specific files, and keep host credentials and the Docker socket outside the workspace. The container can make outbound connections according to the Docker host's network policy.

The SDK's optional live() viewer starts a separate HTTP server without authentication. If you use it, restrict access with the machine's firewall. The noVNC viewer over SSH uses the desktop's viewer password.

Use Docker Compose

The checked-in Compose file publishes the API and viewer on all host interfaces and leaves both credentials unset by default. Before starting it on a server, replace the service's ports block with:

yaml
ports:
  - "127.0.0.1:${DESKTOP_VNC_PORT:-6080}:6080"
  - "127.0.0.1:${DESKTOP_API_PORT:-8095}:8095"

Set a unique DESKTOP_TOKEN and a separate DESKTOP_VNC_PASSWORD before running docker compose up -d --build. The viewer password must be eight characters using letters, digits, +, or -. If you set only the API token, the viewer binds to loopback inside the container and is unreachable through the host port. For multiple Compose instances, use a unique project name, ports, credentials, and workspace per desktop. See Docker setup.