# Deploy a container

Serve anything a model Endpoint cannot: another model type, private or gated
weights, or your own serving code. You supply a container image; Nestor runs it
on dedicated accelerators and gives it a durable, asynchronous request API.

## Requirements

- The image is pinned by digest (`registry/name@sha256:…`).
- The server listens on a port of 1024 or above and runs as a non-root user.
- It answers a readiness path once it can serve.
- Software and weights are in the image or mounted from [Data](/data). The
  container runs without internet access, with a bounded scratch volume.

## Deploy

Describe the container in a JSON file:

```json
{
  "image": "registry.example/your-server@sha256:…",
  "port": 8000,
  "cpu": 2,
  "memory_bytes": 4294967296,
  "readiness": {"path": "/health", "timeout_seconds": 5},
  "interface": "generic_http"
}
```

```sh
nestor inference endpoints create-container --container-file container.json --name my-server
```

`interface` is `generic_http` (JSON in, JSON out) or `comfyui` (ComfyUI
workflows). Optional fields:

| Field | Use |
| --- | --- |
| `pull_secret_id` | A [Secret](/inference/keys) holding the registry credential for a private image. |
| `entrypoint`, `command` | Override the image's entrypoint or command. |
| `environment` | Plain environment variables. |
| `secret_environment` | Environment variables filled from Secrets by ID. |
| `inference_path` | The path your server accepts requests on. |

## Send requests

Each request is durable: `submit` returns an Operation right away, and the
result can be read for **30 days** after the request finishes, whether or not you
have read it before. After that it is erased. Collect results within that window
and store what you need to keep; files your container publishes as
[Data](/data) follow Data's own retention instead.

```sh
nestor inference endpoints submit ENDPOINT_ID --input-file input.json
nestor inference endpoints invocation ENDPOINT_ID INVOCATION_ID --result
nestor inference endpoints cancel-invocation ENDPOINT_ID INVOCATION_ID
```

```python
operation = client.inference.endpoints.submit(endpoint, {"prompt": "a lighthouse at dusk"})
result = client.inference.endpoints.invocation(endpoint, "INVOCATION_ID", result=True)
```

To give one request its own files, pass Data bindings with `--data-file` (SDK:
`data=`). Activity in the Console lists queued, running and finished requests.

## Failures

Runtime failures are reported with fixed messages; Nestor never exposes raw
container output or response bodies, because they can contain inputs or secrets.

| Reason | Meaning |
| --- | --- |
| `RUNTIME_INPUT_REJECTED` | Your server rejected the input (HTTP 400 or 422). |
| `RUNTIME_HTTP_FAILED` | Your server returned another unsuccessful status. |
| `INVALID_RUNTIME_RESPONSE` | The response was not valid JSON or was too large. |
| `DEADLINE_EXCEEDED` | The request ran past its time limit. |

Delete the Endpoint when you no longer need it; like a model Endpoint, it holds
its accelerators until deleted.
