> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Images and Environment

> Supported container images, what an image needs to use the GPUs, and how a sandbox's command, working directory, and environment variables are resolved.

## Images

`image.ref` is a standard image reference of up to 1,024 characters, such as `ubuntu:24.04`, `docker.io/library/python:3.12-slim`, or `ghcr.io/acme/trainer:1.4@sha256:…`.

* The image must be publicly pullable and have a `linux/amd64` variant.
* The registry must be a public DNS name. IP literals, `localhost`, single-label hosts, and registries that resolve to internal addresses fail with `422 registry_not_allowed`.
* Before the sandbox is placed, the reference is resolved to the `linux/amd64` manifest's digest, and the image's configuration is read from it. The sandbox then runs exactly that digest, even if the tag moves later. The pinned reference appears as `resolved.image` (`host/repo@sha256:…`).
* An image that can't be pulled or used ends the sandbox with `termination_reason: image_pull_failed` and, when known, the registry's message or the failed check in `termination_message`.

Images run as the user their configuration names, `root` included. The sandbox's VM isolates the container from the host and from other sandboxes.

## GPUs

Every GPU on the sandbox's node is passed through to its VM, and the NVIDIA driver runs in the VM. When the container starts, it gets the GPU devices (`/dev/nvidia*`), the driver's libraries (such as `libcuda` and `libnvidia-ml`), and `nvidia-smi`. A plain `ubuntu:24.04` image can run `nvidia-smi` without any changes.

* **Don't install an NVIDIA driver in the image.** The driver is provided, and driver libraries in the image can conflict with the ones added at start.
* **Use a glibc-based image**, such as Debian, Ubuntu, or an `nvidia/cuda` image. The driver's libraries and tools are built for glibc and don't run in musl-based images such as Alpine.
* **Bring the CUDA libraries your workload needs** in the image, for example from an `nvidia/cuda` base image or a framework image such as PyTorch's. Their CUDA version can't be newer than the driver supports, which `nvidia-smi` shows as `CUDA Version`.

## Command

| Request | Main process |
| - | - |
| `command` set | `command` is the full argv. It replaces both the image's `ENTRYPOINT` and `CMD`. |
| `command` omitted | The image's `ENTRYPOINT` followed by its `CMD`. |
| Neither | The sandbox ends with `termination_reason: no_command`. |

Entrypoint wrapper scripts (`docker-entrypoint.sh "$@"` style) work unchanged. The final argv appears as `resolved.command`.

## Working Directory

`workdir` must be an absolute path (`422 invalid_workdir` otherwise). Without it, the image's `WorkingDir` is used, then `/`. Execs default to the same directory. The final value appears as `resolved.workdir`.

## Environment Variables

The environment is merged in this order, later entries winning:

1. The image's `Env`.

2. Variables set by Telnyx:

   | Variable | Value |
   | - | - |
   | `TELNYX_SANDBOX_ID` | The sandbox's ID (`sb-…`). |
   | `TELNYX_SANDBOX_REGION` | The region the sandbox runs in. |
   | `TELNYX_SANDBOX_DATA_DIR` | `/data`, the path of the sandbox's own disk. |

3. The request's `env`.

`env` names must be POSIX names and can't start with `TELNYX_SANDBOX_`. The limits are 256 variables, 32 KiB per variable, and 256 KiB in total. Any violation fails with `422 invalid_env`. Execs inherit the sandbox's environment and can add variables on top.

> [!WARNING]
>
> `env` values are stored with the sandbox and returned by `GET /v2/ai/sandboxes/{sandbox_id}` and the exec endpoints. Don't put credentials in `env`. To give a sandbox a credential, write it to a file with the [Files](https://developers.telnyx.com/docs/gpu-sandboxes/files.md) API once the sandbox is running; file contents aren't stored by the API.

## Reserved Paths

`/.telnyx` inside the sandbox is reserved. The [Files](https://developers.telnyx.com/docs/gpu-sandboxes/files.md) API refuses to write or delete under it.

## Persistent Data

Sandboxes have no persistent volumes or snapshots. `/data`, the sandbox's own disk, and the root filesystem are both gone when the sandbox ends. Write large files such as model weights and caches under `/data`: everything written outside it counts against the root filesystem limit (see [Whole-Node Rental](https://developers.telnyx.com/docs/gpu-sandboxes/resources.md#whole-node-rental)). Read inputs from and write results to [Telnyx Cloud Storage](https://developers.telnyx.com/docs/cloud-storage/overview.md) or another S3-compatible store from inside the sandbox. Use the [Files](https://developers.telnyx.com/docs/gpu-sandboxes/files.md) API for files of up to 64 MiB.
