---
title: "Writing Compose Files"
description: "What a CRT accepts in a Docker Compose file, how it records the file in the manifest, how to pass secrets, and how to run GPU workloads."
source: "Verifiable Compute"
---
A CRT job is a Docker Compose file. The runtime accepts most of the Compose options a job needs,
but rejects any option that could read files from the host VM or share its namespaces. Those
options would let a workload get around what the manifest records.

The runtime checks every file when you start it, and returns HTTP 400 naming the first field it
rejects. The [Web Console](./web-console.mdx#launch) catches the most common problems before you
start, but not all of them: a file can pass its **Validation** panel and still be rejected.

## Workload restrictions

### What you can use

| Area                | Allowed                                                                                                   |
| ------------------- | --------------------------------------------------------------------------------------------------------- |
| Top level           | `services` (required, not empty), `volumes`, `networks`, `name`, `version`, and `x-` extension fields      |
| Images              | `image`, `pull_policy`, `platform`. Every service needs an `image`; the runtime cannot build one           |
| Process             | `command`, `entrypoint`, `environment`, `user`, `working_dir`, `init`, `stdin_open`, `tty`, `stop_signal`, `stop_grace_period` |
| Lifecycle           | `depends_on`, `restart`, `healthcheck`, `profiles`, `labels`                                              |
| Networking          | `ports`, `expose`, `networks`, `hostname`, `domainname`, `container_name`, `extra_hosts`, `dns`, `dns_search`, `dns_opt` |
| Storage             | Named volumes (`cache:/data`) and anonymous volumes (`/data`), optionally `:ro` or `:rw`                  |
| Resources           | `mem_limit`, `mem_reservation`, `memswap_limit`, `cpus`, `cpuset`, `cpu_shares`, `cpu_period`, `cpu_quota`, `pids_limit`, `shm_size`, `ulimits` |
| Hardening           | `read_only`, `cap_drop`                                                                                   |
| GPUs and scheduling | `gpus`, and `deploy` with `resources`, `replicas`, `restart_policy`, `labels` or `mode`                    |

Top-level `volumes` can set only `driver: local` and `labels`. Top-level `networks` can set only
`driver: bridge`, `labels`, `internal` and `attachable`.

### What is rejected

| Rejected                                                                       | Why                                                                     |
| ------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
| Host paths in `volumes`, absolute (`/etc:/etc`) or relative (`./data:/data`)   | They read the host VM's files, which the manifest does not cover        |
| `mounts`, `tmpfs`, `devices`, long-form volumes other than `type: volume`      | Other ways to mount host files or devices                               |
| `external` volumes or networks, volume `driver_opts`, `volume_driver`, non-local volume drivers, non-bridge network drivers | They can point at resources that exist outside the job, or hide a bind mount |
| `privileged`, `cap_add`, `security_opt`, `runtime`                             | They weaken the container sandbox                                       |
| `network_mode`, `pid`, `ipc`, `userns_mode`                                    | They share the host's namespaces                                        |
| `build`, `env_file`, `include`, `extends`, `secrets`, `configs`                | They read files from the host while the file is being loaded            |
| Volume targets that are relative or contain `$`                                | The target must be a literal absolute path inside the container         |
| Any other field                                                                | The accepted fields are an explicit list; anything new is rejected      |

The runtime then adds the following to every service:

- the `/input`, `/output` and `/proof` mounts (see [Folders](./tutorials/whisper-example.mdx#folders))
- an `extra_hosts` entry for `docker.eqtylab.internal`, so containers can reach the notary

Don't declare these yourself.

### Starting and stopping

The runtime runs one job at a time. If a start fails, the runtime removes the job's containers and
returns an error, and you can start again straight away. If it cannot remove them, the job stays
active and you need to stop it first.

Leave auto-stop on for batch jobs. For a service such as an inference API, turn it off
(`start --no-autostop` on the [command line](./cli.mdx#jobs)).

### Serving HTTPS from a job

Once a job has started, the CRT opens port 443 and forwards it to port `8080` on the VM. The TLS
certificate on port 443 is issued inside the TEE. To serve your API on
`https://<CRT address>/`, publish the port it listens on as `8080`:

```yml
ports:
  - "8080:8000"
```

## How the compose file is recorded

The manifest does not record the file exactly as you sent it. The runtime first adds its mounts
and host entry, and then writes a **sanitized** copy, which is the one it signs. In that copy:

- Each `VCOMP_SECRET_` prefix is removed and the value replaced with `*`.
  `VCOMP_SECRET_HF_TOKEN=hf_abc` is recorded as `HF_TOKEN=*`.
- The job's `project_id` in the injected mount paths is replaced with `_uuid_`. This keeps
  identical jobs giving identical records.

The sanitized copy is stored with the job's proof files, under
`instance/<project_id>/proof/compute/docker-compose-sanitized.yml`.

Because the sanitized form is deterministic, you can check that a manifest describes your file
without running it. `vcomp-crt-api-cli cid-compose-file <compose-file>` (from the
[command line tools](./cli.mdx#install)) applies the same steps on your machine and prints the
content identifier. Compare that with the one in the manifest.

Everything else in the file is recorded as written: image names, `command`, `entrypoint`, labels,
and every environment variable that does not use the prefix.

## Secrets

To pass an API token, registry key or other secret, add the `VCOMP_SECRET_` prefix to the
variable's name:

```yml
environment:
  - VCOMP_SECRET_HF_TOKEN=hf_replace_me
```

The container receives `HF_TOKEN=hf_replace_me`, and the manifest records `HF_TOKEN=*`.

:::caution[Masked in the proof, not hidden at runtime]
The prefix keeps a secret out of the signed manifest, and so out of the record you share. It does
**not** hide it from anyone who can operate the CRT. That is intended: whoever runs the job
needs to see what it is running.

- Any operator with a valid certificate can read the unmasked file with
  `vcomp-crt-api-cli status docker_compose`.
- The container sees the value as an ordinary environment variable. If the workload prints it
  or writes it to `/output`, it ends up in the logs or in the job's outputs.
- Only `environment` is masked. A secret in `command`, `entrypoint`, a label or an image name is
  recorded in plain text.
:::

Because of that, use a short-lived token with the narrowest scope that works: a read-only,
repository-scoped Hugging Face token, say, rather than your account's long-lived one. Revoke it
when the job is finished.

## GPU workloads

GPU workloads need the **GPU image** of the CRT. See [Deployment Artifacts](./deployment/deployment_artifacts.mdx).

On that image, `nvidia` is Docker's default runtime, so every container runs under it. There is
nothing to install or configure in the job.

### GPU workloads in Compose

Common GPU Compose snippets need small changes to pass the
[workload restrictions](#workload-restrictions):

| Instead of                                                 | Use                                                                                                 |
| ---------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `runtime: nvidia` (rejected)                               | Nothing: `nvidia` is already the default runtime                                                    |
| `devices: [/dev/nvidia0, ...]` (rejected)                  | `gpus: all`, or a `deploy.resources.reservations.devices` entry with `driver: nvidia`               |
| `devices: [nvidia.com/gpu=all]` (CDI, rejected)            | Same as above. The runtime runs in legacy mode with no `/etc/cdi` spec                               |
| `ipc: host` (rejected)                                     | `shm_size: 16gb`, sized to the model                                                                |
| A host-path model cache (`/data/hf:/root/.cache/...`)      | A named volume, for example `hf-cache:/root/.cache/huggingface`                                     |
| A plain `HF_TOKEN=` or `NGC_API_KEY=`                      | `VCOMP_SECRET_HF_TOKEN=`. The prefix is removed and the value masked in the manifest; see [Secrets](#secrets) |

Because every container runs under the nvidia runtime, setting `NVIDIA_VISIBLE_DEVICES` in
`environment` also exposes GPUs, even without a `gpus` or `deploy` request. Many CUDA base images
already set it. To keep a helper container off the GPUs, set `NVIDIA_VISIBLE_DEVICES=void`.

### Example: vLLM server

A stock vLLM server, published on `8080` so it is also reachable over HTTPS on port 443. Start it
with auto-stop off:

```yml
services:
  vllm:
    image: vllm/vllm-openai:v0.10.1.1
    command: ["--model=Qwen/Qwen3-8B", "--host=0.0.0.0", "--port=8000"]
    environment:
      - VCOMP_SECRET_HF_TOKEN=hf_replace_me
    volumes:
      - hf-cache:/root/.cache/huggingface
    ports:
      - "8080:8000"
    shm_size: 16gb
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
volumes:
  hf-cache:
```