Build and use a custom image based on Lindorm Ray public images. Pre-package your dependencies to ensure runtime consistency, speed up job startup, and support complex use cases.
Prerequisites
Ensure that you meet the following prerequisites:
-
You have activated Lindorm Compute Engine (Activate Service).
-
You have a Container Registry (ACR) instance in the same region as your Lindorm instance (Create an Enterprise Edition instance).
Usage notes
Follow these rules to ensure stability and compatibility:
-
In your
Dockerfile, do not modify any files in the following directories or their subdirectories:-
/tmp/ray/ -
/opt/ -
The Ray installation directory. For example, with Python 3.11, the path is
/home/ray/anaconda3/lib/python3.11/site-packages/ray/.
-
-
Push the custom image to an ACR repository in the same region as your Lindorm instance. Lindorm cannot pull images from other regions.
Core workflow
Using a custom image involves four main steps:
-
Prepare and build: Write a
Dockerfilebased on an official Lindorm Ray public image and build your custom image. -
Push the image: Push the built image to your Alibaba Cloud ACR repository.
-
Authorize access: Grant Lindorm one-time access to your ACR repository.
-
Configure and use: When creating a Ray resource group, specify your custom image in the Advanced Configurations section.
Step 1: Prepare and build a custom image
Get the Lindorm Ray public image address
Lindorm provides public images with pre-configured Ray environments. Use them as the base for your custom image.
-
Image pull address format:
docker pull lindorm-compute-public-registry.cn-hangzhou.cr.aliyuncs.com/lindorm-ray/ray:[image-tag] -
Available tags:
Image tag
Python version
GPU support
2.50.1-1.1.1-py310-cpuPython 3.10
No
2.50.1-1.1.1-py311-cpuPython 3.11
No
2.50.1-1.1.1-py310-gpuPython 3.10
Yes (CUDA pre-installed)
2.50.1-1.1.1-py311-gpuPython 3.11
Yes (CUDA pre-installed)
Dependency version guidance
Select compatible dependency versions from the official Ray dependency list. Use pip install -c requirements_compiled.txt to apply version constraints.
Write a Dockerfile
Create a Dockerfile that extends a Lindorm Ray public image with your dependencies.
Example Dockerfile:
FROM lindorm-compute-public-registry.cn-hangzhou.cr.aliyuncs.com/lindorm-ray/ray:2.50.1-1.1.1-py311-cpu
RUN pip install --no-cache-dir numpy pandas
Do not modify files in the /tmp/ray/, /opt/, or Ray installation directories, or their subdirectories. For example, in a Lindorm Ray image with Python 3.11, the Ray installation directory is /home/ray/anaconda3/lib/python3.11/site-packages/ray/.
Build the image
Run the following command in the directory containing the Dockerfile to build the image.
docker build -t your-image-name:tag .
Step 2: Push the image to ACR
Push the built image to your ACR repository.
Log in to ACR
docker login --username=<your-username> <your-registry>
Tag and push the image
docker tag your-image-name:tag <your-registry>/<namespace>/<repo>:tag
docker push <your-registry>/<namespace>/<repo>:tag
Step 3: Authorize Lindorm to access ACR
On the Ray resource group creation page, authorize Lindorm to access your ACR repository.
-
Click "Password-free Access to ACR Custom Images".
-
In the dialog box, confirm the authorization.
This authorization is one-time. Subsequent resource groups reuse it.
Step 4: Use the custom image
When creating a Ray resource group, add the following JSON in the Advanced Configurations section to specify your custom image.
{
"clusterConfig.image.custom.acr.instanceId":"your-acr-instanceId",
"clusterConfig.image":"your-full-image-addr"
}
Configuration parameters:
|
Parameter |
Description |
Example |
|
|
Your ACR instance ID. |
|
|
|
The full image address, in the format |
|
You can now create a Ray resource group with your custom image.