# Private Registries

<subtitle>Pull base images from private registries to build your custom templates.</subtitle>

## Environment Setup

Before using the SDK, please ensure that the `AGENTBOX_API_KEY` environment variable is configured.

>
> You can obtain your API key from the [Console API Keys page](https://console.ucloud.cn/modelverse/experience/api-keys).

```bash
export AGENTBOX_API_KEY=your_api_key
```

If your base images are hosted in private registries, you can use the following helper functions to provide credentials:

*   Generic Registry
*   UHub Registry

## Generic Registry

```python
from ucloud_sandbox import Template

Template().from_image(
    image="ubuntu:22.04",
    username="user",
    password="pass",
)
```

## UHub Registry

UHub is a container image registry service provided by UCloud.

| Parameter | Description |
|------|------|
| `image` | UHub image address, e.g., `uhub.service.ucloud.cn/xxx/myimage:latest` |
| `username` | UHub username, e.g., `user@ucloud.cn` |
| `password` | UHub independent password |

```python
from ucloud_sandbox import Template

Template().from_uhub_registry(
    image="uhub.service.ucloud.cn/your-org/your-image:tag",
    username="user@ucloud.cn",
    password="your-uhub-password",
)
```

