---
title: Daemons
description: Learn how Vercel Daemons are represented in the Build Output API.
url: "https://vercel.com/docs/build-output-api/daemons"
last_updated: 2018-10-20
related:
  - /docs/daemons
  - /docs/build-output-api/configuration
  - /docs/container-registry
  - /docs/daemons/config-reference
install_vercel_plugin: npx plugins add vercel/vercel-plugin
search_with_vercel_cli: npx vercel@latest docs search "<query>"
search_kb_with_vercel_cli: npx vercel@latest kb search "<query>"
---

# Daemons

A deployment can declare [daemons](/docs/daemons), which are long-running containers that don't receive traffic. In the Build Output API, the top-level `config.json` lists the deployment's daemons, and each daemon has a descriptor under `.vercel/output/daemons/<name>` that points to a prebuilt container image. To configure daemons in your project, see [Daemons](/docs/daemons).

## Declaring daemons

**Build Output Configuration File**: `.vercel/output/config.json`

<br />

List the deployment's daemons in the top-level `config.json` through a [`daemons`](/docs/build-output-api/configuration#daemons) object. Each key is a daemon name, and each value is an empty object:

```json
{
  "version": 3,
  "daemons": {
    "worker": {},
    "scheduler": {}
  }
}
```

The `daemons` object is the complete set of daemons for the deployment. When the deployment becomes the production deployment, Vercel stops every daemon that an earlier deployment declared and this object doesn't list. A `config.json` with an empty `daemons` object, or with no `daemons` property, declares no daemons, so Vercel stops all of them.

## Daemon descriptor

**Daemon Configuration File**: `.vercel/output/daemons/<name>/.vc-config.json`

<br />

Every daemon listed in `config.json` needs a descriptor at `.vercel/output/daemons/<name>/.vc-config.json`. The descriptor references an image that's already pushed to [Vercel Container Registry](/docs/container-registry). Vercel doesn't build images from the Build Output API.

```ts
type ServiceBinding = {
  type: 'service';
  service: string;
  format: 'url';
  env: string;
};

type LivenessHttpHeader = {
  name: string;
  value: string;
};

type LivenessHttpGet = {
  port: number;
  path?: string;
  host?: string;
  scheme?: 'HTTP' | 'HTTPS';
  httpHeaders?: LivenessHttpHeader[];
};

type LivenessProbe = {
  httpGet: LivenessHttpGet;
  initialDelaySeconds?: number;
  periodSeconds?: number;
  timeoutSeconds?: number;
  successThreshold?: number;
  failureThreshold?: number;
};

type DaemonDescriptor = {
  runtime: 'container';
  image: string;
  command?: string[];
  instances: Record<string, number>;
  resources?: {
    requests: {
      memory: '1Gi' | '2Gi' | '4Gi' | '8Gi';
    };
  };
  livenessProbe?: LivenessProbe;
  terminationGracePeriodSeconds?: number;
  bindings?: ServiceBinding[];
};
```

| Key           | Type                     | Required | Description                                                                                                                                       |
| ------------- | ------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| **runtime**   | `"container"`            | Yes      | The daemon runtime. Must be `"container"`.                                                                                                        |
| **image**     | `string`                 | Yes      | The image reference in Vercel Container Registry, such as `vcr.vercel.com/my-team/my-project/daemon.worker@sha256:<digest>`.                     |
| **command**   | `string[]`               | No       | The command and arguments to run. Defaults to the image's `ENTRYPOINT` and `CMD`.                                                                 |
| **instances** | `Record<string, number>` | Yes      | The number of instances to run in each region, keyed by region ID. Each count is an integer from `0` to `100`.                                    |
| **resources** | `object`                 | No       | The memory for each instance. See [`resources`](/docs/daemons/config-reference#resources).                                                         |
| **livenessProbe** | `LivenessProbe`      | No       | An HTTP `GET` health check that Vercel requests periodically to check that the instance is still healthy. Has the same fields as [`livenessProbe`](/docs/daemons/config-reference#livenessprobe) in `vercel.json`. |
| **terminationGracePeriodSeconds** | `number` | No | The number of seconds Vercel waits after `SIGTERM` before terminating the instance. An integer from `0` to `3600`. Defaults to `30`. See [`terminationGracePeriodSeconds`](/docs/daemons/config-reference#terminationgraceperiodseconds). |
| **bindings**  | `ServiceBinding[]`       | No       | Bindings to services in the same deployment. Each `service` must be a service in the build output. See [`bindings`](/docs/daemons/config-reference#bindings). |

```json filename=".vercel/output/daemons/worker/.vc-config.json"
{
  "runtime": "container",
  "image": "vcr.vercel.com/my-team/my-project/daemon.worker@sha256:3f1b...",
  "command": ["node", "worker.js"],
  "instances": { "iad1": 2 },
  "resources": { "requests": { "memory": "2Gi" } }
}
```

## Directory structure

**Daemons Directory**: `.vercel/output/daemons`

<br />

The `worker` and `scheduler` daemons above produce the following output, next to the rest of the deployment's build output:

- `.vercel/`
  - `output/`
    - `config.json`
    - `daemons/`
      - `worker/`
        - `.vc-config.json`
      - `scheduler/`
        - `.vc-config.json`
    - `static/`
      - `index.html`

<br />

When you use `vercel build`, the CLI builds each daemon's `Dockerfile`, pushes the image to Vercel Container Registry, and writes these files for you.

## Constraints

- Daemon names contain only lowercase letters separated by `_`, `__`, or one or more `-`, and are limited to 64 characters. See [Daemon names](/docs/daemons/config-reference#daemon-names).
- Each daemon listed in `config.json` must have a descriptor. A missing descriptor fails the deployment.
- The `image` must be in Vercel Container Registry.
- Routes can't target a daemon, because daemons don't receive traffic.

## Search the docs from your terminal

Search the Vercel docs and read pages as Markdown with the Vercel CLI. No login required.

```bash
# Find docs pages by keyword
npx vercel@latest docs search "environment variables"
npx vercel@latest docs search "function timeout"

# Print a docs page as Markdown, by path or URL
npx vercel@latest docs inspect <page>
```

## Search guides from your terminal

Search the Knowledge Base and read guides as Markdown with the Vercel CLI. No login required.

```bash
# Find guides by keyword
npx vercel@latest kb search "rewrites and redirects"
npx vercel@latest kb search "AI SDK streaming"

# Show the latest guides
npx vercel@latest kb

# Print a guide as Markdown, by slug or URL
npx vercel@latest kb inspect <guide>
```

---

[View full sitemap](/docs/sitemap)


If you encounter incorrect information, can’t find what you need, need a capability Vercel doesn’t currently offer, or have any other feedback to report, please do it by following the instructions at https://vercel.com/feedback.md.
