---
title: "Services — Dozable docs"
description: "A service is a program on this Mac that Dozable keeps running for a workspace, or for the Mac itself: a web server you preview, a bridge your agents talk to, a logger."
url: https://dozable.com/docs/services
image: https://dozable.com/og-image.png
source: "Dozable manual"
updated: 2026-12-03
chapter: 47
---
# Services

A service is a program on this Mac that Dozable keeps running for a workspace, or for the Mac itself: a web server you
preview, a bridge your agents talk to, a logger. It belongs to Dozable, not to whoever started it, so it goes on running
when that session ends, when the daemon restarts, and after an upgrade.

```
doz service add bridge --in team --folder ~/work/bridge-copy --port 8770 --health http:/healthz \
  --env-file BRIDGE_TOKEN=~/.secrets/bridge-token -- node scripts/bridge.mjs --port 8770
doz service ls
bridge  running  port 8770  health ok  Fenced  owner team
```

## What a service is

- **Its owner.** `--in W` makes it a workspace's service, `--mac` this Mac's. The workspace's page lists it in its
  Services table, and `doz workspace show W` lists it under services (also in its `--json`). A service of a helper's workspace is listed under that workspace.
- **Its folder.** It runs from a folder of its owner: one of the workspace's folders, or its own folder under your
  projects folder. A service of this Mac's may run from any folder of yours, but never from Dozable's store,
  `~/.claude` or `~/Library`.
- **Its program.** A relative program (`./serve.sh`, `bin/server`) is found from the folder the service starts in,
  never from wherever you typed the command; a bare name (`node`) is found on your PATH. `--cwd SUB` starts it in a
  folder inside its folder (a monorepo's `web/`); its fence is still its folder's. A service whose first start fails
  (no such program, or it exits at once) is not added: the refusal shows its last lines, and nothing is left behind.
- **Fenced** by default. It can read and write its folder and listen on its port, and nothing else of yours.
  `--no-fence` runs it as you, with your files and your logins. You confirm that at the terminal (or with `--yes`),
  and the table shows "No fence".
- **Kept running.** When it dies, Dozable restarts it, the way it restarts a kept agent
  ([Keep an agent running](https://dozable.com/docs/keep-an-agent-running.md)): after 2 s, 10 s, 60 s, then 300 s for quick deaths in a row.
  After 5 restarts with no 10-minute run between them, it stops restarting and says so in this Mac's Needs you, with
  what the restart lost.
- **Its health.** `--health http:/PATH` (an answer of 2xx or 3xx), `tcp` (the port accepts a connection) or
  `command:CMD` (exits 0) is checked every 15 seconds. Three failures in a row restart it. A service with no port is
  allowed: without `--health`, its health is its process.
- **Its port.** A port that another service or another program already listens on is refused, and the refusal says
  which one: "port 8770 is taken on this Mac by node (pid 812)". A server you just stopped does not hold its port:
  connections it left closing are not a listener. A workspace's agents reach its services' ports as
  `host.dozable.internal:PORT` from the next time they start.
- **Its secrets are files.** Dozable never stores, logs or shows a secret's value:
  - `--secret-file F` opens the service's fence to that one file, and the program reads it itself;
  - `--env-file VAR=F` puts the file's content into the program's environment as `VAR`, read again at each start.

  The file must be yours, 0600 and outside the service's folder.

## What it printed

`doz service logs NAME` shows the last lines its program printed (`-n 100` for more), and `--follow` keeps printing
what it prints next (Ctrl-C ends it). After it ended, it shows its last screen. `doz service show NAME` points at it.
When a service dies, the line it is said to have ended with skips a runtime's closing banner such as `Node.js v22.11.0`.

## Stopping on purpose

- `doz service stop NAME` is a person's stop, never a crash. Dozable does not restart the service until you start it
  again (`doz service start NAME`). A deploy can do exactly this: stop, rebuild, start.
- `doz service pause NAME --for 10m` is a deploy window. The program keeps running, but if it dies during the window
  it is not restarted. When the window ends, Dozable starts the service if it is not running.
- `doz service rm NAME` stops it, clears its tailnet mapping and forgets it. A workspace's delete removes its services.
  A run's finish removes a space file's service that `lives: run`.

## Managed elsewhere

A program that launchd already runs under its own job (a chat server installed with its own LaunchAgent) is added with
`--launchd LABEL`. Dozable shows it as managed elsewhere, with the process id launchd reports, and never starts, stops
or replaces it.

## On your tailnet

`--tailnet 8443` maps the service on Dozable's tailnet node (`doz ui publish tailscale` sets that node up):
`https://<node>:8443` reaches the service's port. Dozable sets the mapping when the service starts and clears it when
the service is removed.

## In a space file

A space file's owned `services:` are planned and started by `up`. Each one is Fenced, its `folder:` is a name from
`folders:`, its port is the first of `ports:`, and `health: { http: URL }`, `{ tcp: PORT }` or `{ command: … }` is
checked as above.

```yaml
services:
  docs: { command: python3 -m http.server 4100, folder: site, ports: [4100], health: { http: "http://127.0.0.1:4100/" } }
```

In this version a service's `env:` is not applied. A secret is `--env-file` instead.

## Folders that last

In a `doz: space/3.2` file:

- `home: true` gives an agent a folder of its own, under the workspace's folder in your projects folder
  (`agents/NAME`). It lasts across the agent's runs and restarts, and is read-write in its fence.
- `folders: [NAME…]` gives an agent its own folders of `folders:` (a clone of yours, say), read-write in its fence.
  Dozable never runs git in an agent's folder.
- `worktrees: allow` on a repository's folder gives its agents' fences a `NAME-worktrees` folder beside it, and the
  repository's `.git/worktrees`, for `git worktree add`.

An agent in a Sandbox shares one folder, so these extra folders are noted for it but not applied there.
