---
title: "Validate Anyscale Runtime in custom Docker images"
description: "Validate that the Anyscale Runtime is properly configured in your custom Docker image using an Anyscale job."
---

# Validate Anyscale Runtime in custom Docker images

This article explains how to test whether the Anyscale Runtime is properly injected into your custom Docker image using an Anyscale job. Use this validation in your CI/CD pipeline or as a manual check after building a custom image.

## Prerequisites

Before running this validation, ensure you've built your custom Docker image following the requirements in [Requirements for an Anyscale container image](/container-image/image-requirement.md). This validation works with both `uv` and `pip` for managed dependencies.

## Solution

Create a Python script that checks for the Anyscale Runtime, then run it as an Anyscale job using your custom image.

### 1\. Create the validation script

Create a file named `validate_runtime.py` with the following content:

```python
import ray

@ray.remote
def func():
    from ray import anyscale
    return hasattr(ray, 'anyscale')

if __name__ == "__main__":
    result = ray.get(func.remote())
    print(f"Anyscale Runtime installed: {result}")
```

### 2\. Submit the validation job

Submit the job using the Anyscale CLI with your custom image:

```bash
anyscale job submit \
  --image-uri <your-custom-image-uri> \
  --entrypoint "python validate_runtime.py" \
  --working-dir . \
  --runtime-env '{"pip": []}'
```

Replace `<your-custom-image-uri>` with your actual image URI. If the Anyscale Runtime is properly configured, the job outputs:

```python
Anyscale Runtime installed: True
```

If the output shows `False`, the Anyscale Runtime isn't properly configured in your image.

## Troubleshooting

If the validation returns `False`, review your Docker image build process. Ensure you're following the requirements in [Requirements for an Anyscale container image](/container-image/image-requirement.md) and copying the Anyscale Runtime files correctly. See [Tutorial: Build a custom container image](/container-image/build-image-tutorial.md) for a complete example Dockerfile.

## Related resources

-   [Requirements for an Anyscale container image](/container-image/image-requirement.md) - Container image requirements
-   [Tutorial: Build a custom container image](/container-image/build-image-tutorial.md) - Building custom images tutorial
-   [What are Anyscale jobs?](/jobs.md) - Anyscale jobs documentation

---

Previous: [Overview](/kb.md) | Next: [VS Code not loading in workspace over VPN (Chrome)](/kb/vscode-vpn-chrome-loading.md)