Skip to content

How to run a desktop in a workspace

A workspace can run a graphical desktop in its VM, and you open it in a browser on the host over HTTPS. The desktop is served by the proxy as the reserved route desktop, at https://desktop.<workspace>.jailoc.local. Host setup (CA trust, names, listener broker) is the one in Proxy Routes.

The examples use a workspace named demo. Its desktop is at https://desktop.demo.jailoc.local.

Limits

  • The desktop uses software rendering: no GPU. The screen follows the size of the browser window, up to 7680x4320; on a HiDPI display it matches the window's device pixels, so a large window costs more CPU to encode.
  • It streams the screen, keyboard, pointer and text clipboard. Audio, microphone, webcam, gamepads, printing and file transfer are off.
  • It is a native desktop in the VM, not a Docker Desktop container and not your host's browser.
  • No browser is preinstalled. With desktop.chrome = true jailoc runs Google Chrome; otherwise the agent installs a browser.
  • The workspace name must be a lowercase DNS label (a-z, 0-9, -), as for any proxy route.

Enable the desktop

[workspaces.demo]
paths = ["~/projects/demo"]
cpu = 4
memory = "6g"

[workspaces.demo.desktop]
enable = true
  • desktop.enable defaults to false. The desktop table can be set in [defaults.desktop] and per workspace; an unset workspace field inherits from [defaults.desktop] field by field.
  • With enable = true, the route desktop exists on its own and serves the Selkies web client on guest port 6080. desktop is reserved: a proxy table can't define a route with that name. Other routes work as described in Proxy Routes.
  • Software rendering is CPU-bound: start from cpu = 4 and memory = "6g".
  • Apply any change to the desktop table with jailoc restart for the workspace. jailoc reload doesn't start or stop a desktop, but still applies changes to ordinary proxy routes.

The guest ports are fixed. With the desktop enabled, 6080 (the Selkies server, on guest loopback, speaking HTTP and WebSockets) is reserved; with Chrome, so is 9222. You can't use them in ports, host_ports, or a custom proxy route. The desktop needs no allowed_hosts or allowed_networks entries and listens on no other port. Port 6081 is reserved for the proxy relay in every workspace. See desktop.

Removing the desktop and jailoc reload

A running VM keeps 6080 (and 9222 with Chrome) reserved until it restarts, even after you turn desktop.enable or desktop.chrome off in the configuration. If you try to use such a port, jailoc reload asks you to run jailoc restart first.

Open the desktop

jailoc up and jailoc restart start or update the background proxy for a workspace with the desktop, as for one with proxy routes. jailoc down drops its routes, and jailoc status shows the route URLs.

  1. Run jailoc proxy install once, and again after you add a workspace. It syncs /etc/hosts with every route, including desktop. Without the listener broker, list desktop.<workspace>.jailoc.local in /etc/hosts yourself; see Set up the host manually.
  2. Open https://desktop.demo.jailoc.local/. The Selkies web client opens the desktop. The browser tab, and the app if you install it from the browser, are named jailoc demo with the jailoc icon: the proxy answers the route's /manifest.json and Selkies' icon paths (/icon.png, /icon-512.png) itself, behind the route's auth, and serves the manifest's icon at /.jailoc/icon.png without a login.
  3. With auth = true in [workspaces.<name>.proxy] or [defaults.proxy], enter the login code at /.jailoc/login first. The login redirects to /.

The desktop route follows the same proxy rules as any other: https_port, https_redirect, auth, the __Host-jailoc session cookie and the exact Host and Origin checks. See How the proxy starts. The desktop route has no entry of its own: it takes auth and https_redirect from [workspaces.<name>.proxy], then [defaults.proxy]. The desktop adds no authentication beyond auth, which is off by default. Whoever reaches the route sees and controls the agent's screen and every program on it, including the agent's session and the secrets in its environment.

Images

  • Images jailoc builds (the embedded Dockerfile, a [base] dockerfile, or defaults.image with a workspace overlay) get a stock desktop layer when desktop.enable is on. The layer supports Ubuntu 24.04 and 26.04 and Debian bookworm and trixie, on amd64 and arm64. It installs apt packages and the pinned upstream Selkies 2.2.1 package, which the build verifies against a checksum before installing.
  • With desktop.chrome on, a Chrome layer follows: google-chrome-stable at desktop.chrome_version and libnss3-tools. The pinned default comes from Google's package pool with a pinned SHA-256; another version comes from Google's apt repository with a signing key verified against a pinned fingerprint. No Google repository stays in the image, so Chrome gets no updates. See Chrome version.
  • An image you set explicitly (image, or defaults.image without an overlay) gets no layer and must contain the desktop itself: Xvfb, openbox, dbus-run-session, xterm and the selkies server with its bundled web client. On Debian or Ubuntu the first four come from the packages xvfb, openbox, dbus-x11 and xterm. Selkies 2.2.1 comes from its upstream releases. With desktop.chrome it must also contain Chrome at /opt/google/chrome/google-chrome (package google-chrome-stable). As with dockerd for enable_docker, jailoc up checks the image on the host for these programs and fails before the VM boots, naming what is missing. It doesn't check the web client: if that is absent, the desktop doesn't become ready. See Image Resolution.

The stock layer adapts Selkies' text clipboard to run without browser workers. With an explicit image, the web client must support worker-free clipboard operation as well; the proxy blocks workers on all routes.

Run programs on the desktop

The desktop is an X11 session on display :1, served by Xvfb, with the Openbox window manager and no panel or background. X11 over TCP is off, so only programs inside the VM reach the display. It opens with an xterm; right-click the desktop for the Openbox menu. Sessions of the agent get DISPLAY=:1, so a GUI program the agent starts appears on the desktop. Until a browser first connects, the screen is at its largest size, 7680x4320; the first browser resizes it to its window.

Environment of desktop programs

The desktop starts at boot with a snapshot of the environment. It holds neither the secrets nor the env values delivered afterwards, so programs started from the desktop menu don't see them. A program an agent session launches inherits that session's current environment, secrets included, even though its window appears on the desktop.

Run Chrome for agents

Set chrome = true next to enable = true, then run jailoc restart:

[workspaces.web]
memory = "6g"

[workspaces.web.desktop]
enable = true
chrome = true
  • Chrome starts automatically after Selkies and runs with its sandbox on. Its profile is /home/agent/.local/share/jailoc/chrome. It is kept on the workspace's state disk like the agent's state, so logins survive restarts; with profile = false it starts empty with every VM, like the agent's state.
  • Remote debugging listens on 127.0.0.1:9222 inside the VM only. It isn't reachable from the host or the network, and guest port 9222 is reserved while Chrome is on: no published port, host port, proxy route or OAuth sign-in callback can use it.
  • Sessions get JAILOC_CHROME_CDP=http://127.0.0.1:9222. Point the agent's browser tooling at it, for example Playwright MCP with --cdp-endpoint http://127.0.0.1:9222, or chrome-devtools-mcp with --browser-url=http://127.0.0.1:9222:

    npx @playwright/mcp --cdp-endpoint http://127.0.0.1:9222
    npx chrome-devtools-mcp --browser-url=http://127.0.0.1:9222
    
  • You see the same browser on the desktop route and can take it over.

  • jailoc restarts Chrome when it exits, for example when you close its window, with a backoff of up to 30 s.
  • /usr/local/bin/google-chrome opens a page in the running Chrome with the same profile.
  • Chrome's NSS database trusts the forwarded ca_bundle. jailoc adds and removes its roots before every Chrome start and on jailoc reload; an open Chrome may trust a new root only after it restarts, for example after you close its window.
  • Use memory = "6g" or more.

Warning

The agent controls Chrome fully, including every login and cookie in its persistent profile.

Chrome version

chrome_version is an exact four-part version, MAJOR.MINOR.BUILD.PATCH, with no channel names. It requires chrome = true. The default is the version the jailoc release pins.

[workspaces.web.desktop]
enable = true
chrome = true
chrome_version = "158.0.8127.107"

The version jailoc pins is checked against a pinned SHA-256 and stays installable. Google's apt repository serves only its current stable version, so another chrome_version builds only while it is that version. Otherwise the image build fails with Chrome <ver> is not the current stable version in Google's repository (<current>, <arch>); set the version the message names, or remove chrome_version.

Troubleshoot

Symptom Check
jailoc up names missing desktop programs The explicit image lacks them; see Images.
Validation error on ports or host_ports Guest ports 6081, 6080 with the desktop and 9222 with Chrome are reserved.
desktop route missing after you set desktop.enable Run jailoc restart <workspace>; jailoc reload doesn't start the desktop.
Validation error that desktop is reserved Remove the desktop entry from proxy; desktop.enable provides the route.
desktop.chrome requires desktop.enable = true, desktop.chrome_version requires desktop.chrome = true Set the field the message names.
Image build fails with Chrome <ver> is not the current stable version in Google's repository Set desktop.chrome_version to the version the message names, or remove it; see Chrome version.
Agent can't reach Chrome Check JAILOC_CHROME_CDP in the session; Chrome listens only inside the VM, on 127.0.0.1:9222.
Certificate warning, name doesn't resolve, login code rejected Same causes as for any route; see Troubleshoot in Proxy Routes.