Skip to main content
Version 1.0 defines how official Dispersed recipes and mirrors start, accept connections, and store files. You can also adopt it for a custom job. To pick a base and build your first image, see Docker images.

The standard at a glance

Part 1: How standard recipes work

Why the standard exists

Your job runs on an independent node operator’s hardware. Running the app, SSH server, and web proxy without administrator privileges limits what a compromised process can change. A fixed user, file layout, and package snapshot also let you move workloads between recipes without changing paths or guessing which system packages a rebuild will install. Every process runs as dispersed with UID and GID 10000. The final Dockerfile user must be USER dispersed, without a group or numeric ID. Images remove sudo and strip setuid and setgid bits at build time. You can install user-level tools in your home directory; system packages and updates to /opt/<app> require a new image.

Connect to a running job

Use the host and mapped port from your Job Run Detail page. Container ports 22 and 8888 describe the services inside the image; the external port can differ.
When launching a recipe in the Console, select your key under SSH Public Key. For an API launch, set the Docker job parameter sshkey. Dispersed passes it to the container as SSH_PUBKEY. Allow your client’s IP address in allowed_ips. Without a key, the entrypoint skips sshd. Only dispersed can log in; root login, passwords, and keyboard-interactive authentication are disabled. You can also transfer files with SFTP or SCP.The container generates an Ed25519 host key on first start and reuses it when the same container restarts.SSH sessions inherit the five XDG directory variables, PATH, LD_LIBRARY_PATH, and variables matching NVIDIA_*, CUDA_*, or HF_* from the workload environment. The filter excludes SSH_PUBKEY, CONTAINER_ACCESS_TOKEN, and names containing TOKEN, SECRET, PASSWORD, or KEY, even when a prefix matches.
To generate a token for Caddy, add this entry to your Job Recipe’s input_schema array:
Dispersed generates the token when you cook the recipe. Every run of that job uses the same token. Cooking the recipe again creates a new job with a new token. For a standalone custom job, set CONTAINER_ACCESS_TOKEN in the job’s environment variables, include 8888 in ports, and allow your client’s public IP range in allowed_ips. A valid token is 16 to 72 ASCII characters matching [A-Za-z0-9_-]{16,72}. By default, Caddy refuses to start if the token is empty or malformed. By default, Caddy generates a self-signed TLS certificate. To use your own, provide both CADDY_TLS_CERT and CADDY_TLS_KEY.
ALLOW_UNAUTHENTICATED=true disables authentication only when CONTAINER_ACCESS_TOKEN is empty. With a valid token, Caddy still requires credentials. With a malformed token, it still refuses to start. CADDY_TLS=off sends credentials over plain HTTP. Use these overrides only for isolated local debugging.

Filesystem and XDG directories

Writes to the container filesystem under /home/dispersed are ephemeral. They do not persist across separate runs. Copy outputs you need out of the container before the run ends.

Startup and shutdown

tini runs as PID 1, forwards shutdown signals, and reaps child processes. It starts /usr/local/bin/dispersed-entrypoint.sh, which:
  1. Exports the XDG variables and creates their directories.
  2. Clears the runtime directory, using the home-directory fallback if needed.
  3. Starts sshd in the background when you supply SSH_PUBKEY.
  4. Executes the image’s CMD. When testing locally with docker run, you can override this command after the image name.
With no command, the container stays available over SSH if you supplied a key. Otherwise, it idles until stopped.

Environment variables

Supported operating systems

Use Debian bookworm or trixie, or Ubuntu 22.04 or 24.04, with apt and bash. The username dispersed and UID/GID 10000 must be available or already identify the same account. Alpine, distroless, and scratch images do not support this standard.

Official images

dispersednetwork/base provides Ubuntu 24.04 and key-only SSH for CLI workloads. dispersednetwork/basic-auth extends it with Caddy for web workloads. These are the two officially supported public bases for building your own recipe.
Mirrors include dispersednetwork/ubuntu:24.04, dispersednetwork/debian:trixie, dispersednetwork/pytorch-pytorch, dispersednetwork/nvidia-cuda, dispersednetwork/nvidia-pytorch, and dispersednetwork/chromadb-chroma.Mirrors retain upstream files, environment variables, labels, and exposed-port metadata. Their provenance labels identify the upstream base and digest. Mirrors replace the upstream entrypoint and idle under SSH when you supply a key. To start the upstream app automatically on Dispersed, build a child image with the app’s startup command as its CMD. For an interactive job, start the app from your SSH session.

Upgrading from previous recipes

A running job keeps its image until it stops. Check scripts and paths before your next run on Standard 1.0.

Known limits

  • If the non-root SSH server cannot bind port 22, as can happen with host networking, the app continues without SSH. Starting the container with --user 0 also disables SSH.
  • You cannot install system packages in an SSH session or let an app update its own files in /opt. Write to your home, /tmp, or XDG_RUNTIME_DIR.
  • New package layers can reintroduce setuid or setgid files. Strip these bits again in each installation layer.

Part 2: Build your own image

Start with Docker and one of the two public bases: dispersednetwork/base for CLI jobs or dispersednetwork/basic-auth for HTTP workloads. Both provide the runtime user, directories, SSH setup, and entrypoint.

Choose a tag

Dispersed records the resolved digest when you create a job. Nodes can still pull by tag, so a retry can use a different image if the tag moves. Choose an immutable content-hash tag when every run must use the same image.

Example 1: Serve a static site

Place index.html beside your Dockerfile. Caddy serves the file on port 8888 using the base image’s authentication and health check.
Dockerfile

Example 2: Run a web app behind Caddy

In a new directory, save the following three files. The sample Node.js API listens only on 127.0.0.1:3000. Caddy is the only public web listener.
server.js
Generate the proxy configuration before starting the app. Give only Caddy the token, then stop both processes if either exits or the container receives a termination signal.
start.sh
Dockerfile
The digest pins the base image. Apt installs Node.js and its dependencies from that image’s recorded Ubuntu snapshot. It verifies the archive signature but allows historical metadata past its expiry date.

Rules for child images

  • Keep USER dispersed, WORKDIR /home/dispersed, and the inherited ENTRYPOINT. To change the launch command, set CMD.
  • Install code as root:root under /opt/<app> without write permission for the runtime user. Write app data, configuration, caches, and state to the corresponding XDG directories.
  • Install extra system packages as root during the build. In the same RUN, strip setuid and setgid bits, as in Example 2. Switch back to USER dispersed.
  • Bind your app to loopback. Do not expose its internal port. Remove CONTAINER_ACCESS_TOKEN from the app environment and supervise the app and Caddy together.
  • Keep or add LABEL com.dispersed.recipe-standard="1.0" for a conforming image. Put new labels last so label edits preserve the package-layer cache.
If / does not return 2xx or 3xx, point the Docker health check at your app’s health route. For example, add HEALTHCHECK CMD bash -c 'source /usr/local/lib/dispersed-http-auth.sh && http_auth_healthcheck /health'.

Test locally

From either web example’s directory, use Docker with linux/amd64 support, OpenSSL, curl, and an SSH key pair. Adjust the key path if needed. Run these commands in the same terminal:
After startup, the first request should print 401. Both authenticated requests should return your site or JSON. Here -k accepts the local container’s self-signed certificate.
The SSH command should print dispersed. Stopping this test container removes its writable filesystem because it started with --rm.