Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@
"instant-clusters/pytorch",
"instant-clusters/axolotl",
"instant-clusters/ray-quickstart",
"instant-clusters/ray-litellm",
"instant-clusters/slurm"
]
}
Expand Down Expand Up @@ -2090,7 +2091,7 @@
},
{
"source": "/instant-clusters/ray-vllm",
"destination": "/instant-clusters/ray-quickstart"
"destination": "/instant-clusters/ray-litellm"
}
],
"description": "Developer documentation for building, deploying, and scaling AI applications on Runpod.",
Expand Down
50 changes: 48 additions & 2 deletions instant-clusters/ray-clusters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ Ray, Python, CUDA, and PyTorch versions are pinned in the image. Because the hea

The supported image is published as pinned, versioned tags of [`runpod/ray-cluster`](https://hub.docker.com/r/runpod/ray-cluster). It includes Python, CUDA, PyTorch, and Ray 2.59.0.

{/* TODO(DOCS-609): Taylor to confirm final tag naming and template name for alpha (known tag: runpod/ray-cluster:1.1.2-cu1281-torch2130-ubuntu2404). Add a vLLM inference variant section once that image ships. */}
{/* TODO(DOCS-609): Taylor to confirm final tag naming and template name for alpha (known tag: runpod/ray-cluster:1.1.2-cu1281-torch2130-ubuntu2404). */}

When you create a Ray Cluster, the console selects the Ray Cluster template automatically. It uses the supported image and exposes the right ports on the head node. If you change the template's ports, Runpod can't guarantee that the cluster works. Use the template as is unless you need dependencies that are slow to install for every job. See [build a custom image](#build-a-custom-image).

## Serve a model with the inference variant

The inference variant of the image (`runpod/ray-cluster:VERSION-inference-cu1300-torch2130-ubuntu2404`) serves one Hugging Face model across every node of the cluster, with no image build. It keeps the same entrypoint, so Ray starts exactly as it does with the base image. After every node has joined, the head node runs vLLM across the whole cluster and serves the model through a [LiteLLM](https://docs.litellm.ai/) proxy on port `4000`, with OpenAI-compatible and Anthropic-compatible APIs.

The **Ray Inference** template uses this image and exposes port `4000`. You configure the model with environment variables such as `MODEL_REPO` and `LITELLM_MASTER_KEY`. To deploy it, send requests, and connect coding agents such as Claude Code, follow [serve a model across a Ray Cluster with vLLM and LiteLLM](/instant-clusters/ray-litellm).

{/* TODO(DOCS-609): replace VERSION with the published tag once runpod/containers#245 ships. */}

## Run Ray jobs

Connect to the head node over [SSH](/pods/configuration/use-ssh) or JupyterLab, then submit work with `ray job submit` or a Python driver.
Expand Down Expand Up @@ -93,6 +101,7 @@ The head node exposes the following HTTP ports through the [Runpod proxy](/pods/
| `8266` | Ray dashboard. |
| `8888` | JupyterLab. |
| `8889` | Grafana. |
| `4000` | Inference API (LiteLLM). Ray Inference template only. |

The console's links to the Ray dashboard, JupyterLab, and Grafana include your token, so you're signed in when you open them.

Expand Down Expand Up @@ -163,10 +172,46 @@ RUN pip install --no-cache-dir my-package==1.2.3
Your image inherits the supported image's entrypoint, start command, and the `com.runpod.ray-cluster.contract` label that Ray Clusters require. To keep your image compatible:

- Don't override `ENTRYPOINT`. The entrypoint is what starts Ray on each node.
- Don't override `CMD`. The start command runs the Ray dashboard, JupyterLab, and Grafana on the head node, and changing it breaks them.
- If you set your own `CMD`, end it with `/start.sh`. See [run your own start command](#run-your-own-start-command).
- Don't upgrade or downgrade Ray. The image logs a warning if the Ray version changes.
- Don't use ports `8265` or `20217` for your own services.

### Run your own start command

The image's default start command is `/start.sh`, which starts SSH, JupyterLab, the Ray dashboard proxy, and Grafana. The entrypoint starts Ray first and then runs the start command, so a custom `CMD` replaces `/start.sh`. If your command doesn't call it, those services don't start, and you can't connect to any node over SSH.

To run your own commands when the container starts, put them in a script that ends by handing off to `/start.sh`:

```bash start.sh
#!/bin/bash
set -euo pipefail

# Your per-boot setup.
python /opt/app/setup.py

# Hand off to the base image's start script.
exec /start.sh
```

```dockerfile
FROM runpod/ray-cluster:TAG

COPY start.sh /opt/app/start.sh
RUN chmod +x /opt/app/start.sh
CMD ["/opt/app/start.sh"]
```

`/start.sh` keeps running after the services start, so handing off with `exec` also keeps the container up. To run a long-lived process alongside the services, start it in the background before the handoff: `my-app & exec /start.sh`.

The start command runs on every node. To run a step only on the head node, check `NODE_RANK`:

```bash
if [[ "$NODE_RANK" == "0" ]]; then
serve deploy /workspace/serve_config.yaml &
fi
exec /start.sh
```

After you push the image, create a [template](/pods/templates/manage-templates) that uses it, then select that template when you create a Ray Cluster.

{/* TODO(DOCS-609): confirm how a customer template is marked Ray-capable in the console (STO-992 rayClusterCapable owner opt-in) and add the exact step here. */}
Expand Down Expand Up @@ -210,5 +255,6 @@ The request has no token or the wrong token. Open the dashboard from the console
## Next steps

- [Deploy your first Ray Cluster](/instant-clusters/ray-quickstart).
- [Serve a model across the cluster with vLLM and LiteLLM](/instant-clusters/ray-litellm).
- [Review Instant Cluster environment variables and networking](/instant-clusters/configuration).
- [Attach a network volume](/storage/network-volumes) to share data and environments across nodes.
Loading