Guides
Running in Docker
Run termlessd as a container with Docker Compose. The files in the release folder, the first start, settings, putting it on your domain with Caddy or a Cloudflare Tunnel, everyday commands, upgrades, backups and moving over from systemd.
The release folder can run Termless as a system service (Running the server) or as a Docker container. Both run the same binary with the same data, so the choice is about the box:
- Docker when the box already runs its services in Docker, or you want Termless as one folder you start, stop, move and delete as a unit.
- systemd for the smallest footprint: no Docker daemon, and the unit already locks the process down as tightly as the container does.
You can move from one to the other later by copying the data folder (below).
What you need#
- Docker Engine with Compose v2:
docker compose versionprints a version. - The release folder for the box's processor,
termless-<version>-linux-x86_64ortermless-<version>-linux-aarch64(uname -mtells you which;arm64isaarch64).
| File | What it is |
|---|---|
termlessd | The server, for this processor. |
Dockerfile | Packs it into an image with nothing else inside: no shell, no libc, no package manager. The binary carries its own root certificates. |
compose.yaml | The service: a data volume, the port on 127.0.0.1 only, an allowlist, a read-only file system, no capabilities, a 512 MB memory cap, an unprivileged user (uid 10001). Its image is tagged with the release's version (termless:<version>), so each release folder runs its own. |
compose.caddy.yaml | Adds Caddy, with HTTPS on your domain. |
compose.cloudflare.yaml | Adds a Cloudflare Tunnel. |
Caddyfile | Caddy's configuration for compose.caddy.yaml. |
example.env | The settings, to copy to .env. |
upgrade-docker.sh | Moves a running install to this release: copies your settings, builds the new image while the old one keeps running, backs up the data, restarts on the new image, checks it started. |
CHANGES.md | What changed in this release and the ones before it, and when the database changed (the What's new page). |
SHA256SUMS | The SHA-256 of every file in the folder: sha256sum -c SHA256SUMS checks them. |
First start#
In the release folder:
cp example.env .env
docker compose up -d --build
docker compose logs termlessThe log shows a one-time setup token. Open http://127.0.0.1:8780 on the box, or from your own computer through an SSH tunnel:
ssh -N -L 8780:127.0.0.1:8780 you@your-boxand then http://127.0.0.1:8780 in your browser. Enter the token and choose the admin password (15 to 200 characters with a lowercase letter, a capital, a digit and a symbol; a long random one is best). Then Accounts > Add account, and API keys for each app that will use it. The rest of these docs are on the same server at /docs.
Settings#
.env, next to compose.yaml, holds what you change:
| Setting | Default | What |
|---|---|---|
COMPOSE_FILE | compose.yaml | Which compose files to use, separated by :. Add compose.caddy.yaml or compose.cloudflare.yaml for a domain (below). |
TERMLESS_PORT | 8780 | The port on the box. It is always bound to 127.0.0.1. |
TERMLESS_TRUST_PROXY | 0 | 1 when a proxy installed on the box itself (outside Docker) forwards to that port. |
TERMLESS_DOMAIN | Your domain, for compose.caddy.yaml. | |
TUNNEL_TOKEN | The tunnel's token, for compose.cloudflare.yaml. |
Any other termlessd setting from Running the server goes in a file of your own, compose.local.yaml, so an upgrade never overwrites it; add it to COMPOSE_FILE in .env (for example COMPOSE_FILE=compose.yaml:compose.local.yaml):
services:
termless:
environment:
TERMLESS_LOG: info,termless=debugAfter a change: docker compose up -d. Do not edit compose.yaml itself; the next release replaces it.
On your own domain#
With Caddy#
Caddy runs as a second container and gets the certificate by itself.
- Point the domain at the box: an
Arecord (andAAAAfor IPv6) for the name, DNS only if the domain is on Cloudflare. Your own domain explains both steps. - Open ports 80 and 443 in the box's firewall and in the cloud provider's firewall.
- In
.env:
COMPOSE_FILE=compose.yaml:compose.caddy.yaml
TERMLESS_DOMAIN=termless.example.comdocker compose up -d. The certificate arrives with the first visit tohttps://termless.example.com.
If another web server already holds ports 80 and 443 on the box, keep it: give it a site that proxies to 127.0.0.1:8780 (Your own domain has the Caddy and nginx versions), keep COMPOSE_FILE=compose.yaml, and set TERMLESS_TRUST_PROXY=1 in .env.
With a Cloudflare Tunnel#
No port is opened and the box's address stays private. The domain must be on Cloudflare.
- In the Cloudflare dashboard: Zero Trust > Networks > Tunnels > Create a tunnel, type Cloudflared. Skip installing a connector there; copy the token from the install command it shows (the long string after
--tokenorinstall). - Add a public hostname: your subdomain and domain, service type
HTTP, URLtermless:8780. - In
.env:
COMPOSE_FILE=compose.yaml:compose.cloudflare.yaml
TUNNEL_TOKEN=paste-the-token-heredocker compose up -d. The tunnel shows as healthy in Cloudflare within seconds.
The compose file also sets what termlessd needs behind Cloudflare: the visitor's address from CF-Connecting-IP and an always-Secure cookie. To ask for a sign-in before the page loads, see a sign-in in front.
Check either way with the steps in Check it worked.
Everyday commands#
Run them in the release folder.
| To | Run |
|---|---|
| Follow the log | docker compose logs -f termless |
| Check the box | docker compose exec termless /termlessd doctor |
| See what is running | docker compose ps |
| Stop, start | docker compose stop, docker compose start |
| Remove the containers, keep the data | docker compose down |
| Remove everything, data too | docker compose down -v (accounts, keys and trails are gone for good) |
The image has no shell, so docker compose exec termless sh does not work; run /termlessd with a command (doctor, passwd, version) instead.
To change the admin password, use Change password in the dashboard (the account menu at the bottom of the sidebar). If you cannot sign in any more, set a new one from the box; read -rs keeps it off the screen and out of the shell history:
read -rs PW && printf '%s\n' "$PW" | docker compose exec -T termless /termlessd passwd; unset PW
docker compose restart termlessUpgrading#
The data volume belongs to the compose project (named termless in compose.yaml), not to a folder, so a new release folder runs on the same accounts, keys and history. Unpack the new release next to the old one and run its upgrade script, naming the old folder:
tar xzf termless-<new version>-linux-x86_64.tar.gz
cd termless-<new version>-linux-x86_64
sh upgrade-docker.sh ../termless-<old version>-linux-x86_64Step by step, it:
- copies
.env(andcompose.local.yaml) from the old folder; - builds this release's image (
termless:<version>) while the old container keeps running, and reads the new version from that image, so nothing runs on the box itself; - stops the container and saves the data volume to
backups/termless-data-<time>.tgz(readable by you alone); - starts the container on the new image, waits up to 30 seconds for it to listen, and prints the version now running.
The database is upgraded in place on start. Because the image is built before anything stops, the outage is only the backup and the restart: accounts log out cleanly and are connected again a few seconds after the new version starts (3.5 to 7 seconds measured on a small server), and open streams end with reason: "server stopping" so clients reconnect. CHANGES.md in the new folder says what changed.
Going back#
Run docker compose up -d in the old folder: its own image is still there, so it starts the old version on the same data. An older version reads the newer one's data as long as the database layout did not change between them; What's new says for each release whether it did, and additions only (new tables or columns) are fine, since an older version skips what it does not know.
When the layout did change, put the backup the upgrade took back first. In the new folder (its backups/), with the server stopped, remove the database's journal files so nothing newer is replayed over the backup, then unpack it:
docker compose stop termless
docker run --rm -v termless_data:/data -v "$PWD/backups":/backup busybox sh -c \
'rm -f /data/termless.db-wal /data/termless.db-shm && tar xzf /backup/termless-data-<time>.tgz -C /data && chown -R 10001:10001 /data && chmod 700 /data'then docker compose up -d in the old folder.
Release folders from before 0.4.0 all built the same image name, termless:local, which holds whichever of them was built last: in such a folder, docker compose up -d --build makes sure it runs its own version.
Backups#
The volume termless_data holds termless.db and master.key. Copy them out while the server is stopped; the archive is written readable by you alone from its first byte (umask 077) and handed to your user:
docker compose stop termless
docker run --rm -v termless_data:/data:ro -v "$PWD":/backup busybox \
sh -c "umask 077 && tar czf /backup/termless-data.tgz -C /data . && chown $(id -u):$(id -g) /backup/termless-data.tgz"
docker compose start termlessTo restore, the other way round: with the server stopped, remove the database's journal files (termless.db-wal, termless.db-shm) so nothing newer is replayed over the backup, unpack it, then give the files back to the server's user:
docker compose stop termless
docker run --rm -v termless_data:/data -v "$PWD":/backup busybox sh -c 'rm -f /data/termless.db-wal /data/termless.db-shm && tar xzf /backup/termless-data.tgz -C /data && chown -R 10001:10001 /data && chmod 700 /data'
docker compose start termlessKeep the archive private: master.key unlocks the MT5 passwords stored in the database.
Moving from systemd to Docker#
Stop the service, copy its data folder into the volume, start the container:
sudo systemctl disable --now termlessd
docker compose up --no-start
sudo docker run --rm -v termless_data:/data -v /var/lib/termless:/old:ro busybox sh -c 'cp -a /old/. /data/ && rm -f /data/termlessd.pid && chown -R 10001:10001 /data && chmod 700 /data'
docker compose up -dSettings you had in the systemd unit (a proxy, an allowlist) move to .env or compose.yaml. When the container runs well, remove the old service: sudo rm /etc/systemd/system/termlessd.service && sudo systemctl daemon-reload, and /var/lib/termless once you no longer want it as a backup.
How the container is locked down#
| User | uid 10001, never root. |
| File system | Read-only, except the data volume at /data. |
| Privileges | Every Linux capability dropped; no-new-privileges. |
| Memory | Capped at 512 MB (it uses about 15 MB with one account). |
| Network | The port is published on 127.0.0.1 only, and TERMLESS_ALLOW_FROM admits only the box itself and the compose network 172.30.80.0/24. If that network clashes with one you already have, pick another private /24 and change it in both places in compose.yaml. With the Caddy or Cloudflare add-on, forwarding headers are trusted only from that container's fixed address (TERMLESS_TRUSTED_PROXIES in the add-on, 0.6.3), never from the network's gateway, where the published port's own traffic arrives too. The add-ons pin their images (caddy:2.11.7-alpine, cloudflare/cloudflared:2026.10.6). |
| Health | There is no HEALTHCHECK (nothing inside could run one); Docker restarts the container if it exits, and termlessd reconnects its accounts by itself. Watch https://<your domain>/api/v1/health from outside, or docker compose exec termless /termlessd doctor. |