Custom Images
When running jobs on AI DataLake, you may need specific software dependencies or a custom runtime environment, such as a custom algorithm library or a specific Python package version. AI DataLake provides built-in images as a foundational environment. You can use a Dockerfile to build a custom image containing the required dependencies based on a built-in image, push the image to Software Repository for Container (SWR), and register it on the AI DataLake console. Registered custom images can then be selected during endpoint creation to standardize and reuse runtime environments.
This section describes how to view built-in images and obtain their SWR addresses, create and register custom images, create an image snapshot for an image version to accelerate container startup, and select an image when creating an endpoint.
Notes and Constraints
Currently, you can register only images created in SWR.
Procedure
- View built-in images on the AI DataLake console and obtain their SWR addresses.
- Use a Dockerfile to package the dependencies (such as files, JAR packages, or software) required for job execution into a base image to generate a custom image, and push the image to SWR.
- Register the custom image on the AI DataLake console.
- (Optional) On the AI DataLake console, create an image snapshot for a built-in image version or custom image version to accelerate container startup.
- Select a built-in or custom image when creating an endpoint. For details about engine endpoint support for built-in and custom images, see Supported Images and Image Snapshots.
Step 1: View Built-in Images and Obtain an SWR Address
- Log in to the AI DataLake console.
- In the left navigation pane, choose Image Management to open the image management page.
- On the Built-in Images page that appears by default, view the built-in images in the system.
You can search for images by keyword in the search box at the top.
- Click a built-in image to open its details page and view its overview and version information.
- Overview: View basic information about the image.
- Version: View the image version/ID, status, type, architecture, SWR address, software count, and description. Click the software count to view the software versions included in the current image, such as the server version, engine version, Java version, Scala version, Python version, and release date.
Step 2: Create a Custom Image
- Prepare the container environment.
For details, see Installing a Container Engine.
- Log in to the prepared container environment as user root and run a command to obtain the base image.
Run docker pull to download the base image to the container environment created in 1.
docker pull Base image download address
The base image download address is the SWR address of the built-in image.
- Access SWR.
- Log in to the SWR console.
- In the left navigation pane, choose Dashboard. Click Generate Login Command in the upper right corner. In the window that appears, click
to copy the login command. - Run the login command on the VM where the container engine is installed.
- Create an SWR organization. If an organization already exists, skip this step.
- In the left navigation pane of the SWR console, choose Organizations. Then, click Create Organization in the upper right corner.
- Enter the organization name and click OK.
- Write a Dockerfile.
- Aura:
If a custom image contains a new third-party dynamic library, add the library path to the LD_LIBRARY_PATH environment variable. (Contact technical support to modify the system configuration file.) Otherwise, the system may fail to locate the third-party dynamic library, leading to SQL execution errors.
This example uses the Aura base image. If a Dockerfile starts with the FROM instruction, it must specify a built-in image as the base image. After the FROM instruction, you can add instructions to customize the image.
# 1. Declare the base image. For details about how to obtain the SWR address of the Aura base image, see Step 1: View Built-in Images and Obtain an SWR Address. FROM your-registry/base-image:latest # 2. Install system-level dependencies as required. For example, your Python package may depend on system-level shared libraries (such as libGL and libgomp). RUN yum install -y \ mesa-libGL \ libgomp \ && yum clean all # 3. Install the Python package. RUN /opt/function/runtime/rtsp/python3.11/bin/pip install --no-cache-dir \ grpcio==1.62.0 \ opencv-python-headless==4.9.0.80 \ scikit-learn==1.4.0
- Ray:
This example uses the Ray base image. If a Dockerfile starts with the FROM instruction, it must specify a built-in image as the base image. After the FROM instruction, you can add instructions to customize the image.
# Dockerfile , For details about how to obtain the SWR address of the Ray base image, see Step 1: View Built-in Images and Obtain an SWR Address. FROM swr.cn-north-7.myhuaweicloud.com/dataartsfabric/ray:2.54.0rc0.PYTHON3_11_5.master.20260822154900.788257a USER root RUN pip install numpy==1.26.0 pandas scikit-learn
- Spark: This example uses the Spark base image. If a Dockerfile starts with the FROM instruction, it must specify a built-in image as the base image. After the FROM instruction, you can add instructions to customize the image.
# Dockerfile FROM swr.cn-north-7.myhuaweicloud.com/ai_datalake/spark_sql_test:4.0.0-3.2.0.202607221127157101575424.x86_64 USER root # MODIFICATIONS GO HERE COPY . /opt/spark/jars/ RUN chmod -R 550 /opt/spark/jars/ RUN chown -R omm:ficommon /opt/spark/jars
- Flink: This example uses the Flink base image. If a Dockerfile starts with the FROM instruction, it must specify a built-in image as the base image. After the FROM instruction, you can add instructions to customize the image.
# Dockerfile FROM swr.cn-north-7.myhuaweicloud.com/ai_datalake/flink-public:1.20.0-<tag> USER root # MODIFICATIONS GO HERE COPY . /opt/flink/lib/ RUN chmod -R 550 /opt/flink/lib/ RUN chown -R omm:ficommon /opt/flink/lib/ USER omm
- Aura:
- After creating the Dockerfile, run the following command to build a custom image:
# build the docker image docker build . -t Huawei Cloud SWR domain name/Organization/Image name:Version
- Push the custom image to SWR.
Go to the SWR homepage, click Generate Login Command to copy the temporary login command, run the command, and push the image to SWR.
# login to SWR docker login -u cn-north-7@<Username> -p <Temporary password> swr.cn-north-7.myhuaweicloud.com # push the docker image docker push Huawei Cloud SWR domain name/Organization/Image name:Version
Step 3: Register the Custom Image
- Log in to the AI DataLake console.
- In the left navigation pane, choose Image Management to open the image management page.
- Click the Custom Images tab to open the Custom Images page.
You can search for images by image name, image type, organization, or description in the search box above the image list.
Figure 2 Viewing custom images
- Click Register Image in the upper right corner of the page and set the parameters by referring to the following table.
Table 1 Parameters for registering an image Parameter
Description
Image Source
The SWR address of the custom image.
Click the image selection box, select the image name and version, and click OK.
NOTE:Currently, only Ray image version 2.54 is supported.
- After you select an image, its organization, name, and version are displayed.
- If no SWR image is available, create a private image in SWR by referring to Step 2: Create a Custom Image.
Description
Enter a brief description of the custom image. This parameter is optional.
Image Type
Select the type of the image to be registered.
Select an image type that matches its actual usage to make subsequent search and management easier.
- AURA_JOB: Aura base image
- RAY_BASIC: Ray base image
- SPARK_JOB: Spark base image
- FLINK_JOB: Flink base image
Associated Built-in Image
If the image type is set to SPARK_JOB or FLINK_JOB, you must associate a built-in image.
Version Type
Select the image version type.
Specify this parameter based on your requirements.
- Stable: Stable image version
- Recommended: Recommended image version
- BETA: Image version used for testing and commissioning.
CPU Architecture
Select the CPU architecture for the image to be registered. Select x86_64 or AArch64 based on your requirements.
Software Version
Enter the software name and version. This parameter is optional.
- Set this parameter based on your requirements to make subsequent search and management easier.
- The Name and Version must contain 2 to 32 characters.
- You can click Add Version to add more entries. You can add a maximum of 100 software versions.
- After configuring the parameters, click OK.
- In the custom image list, you can view the name, type, organization, total versions, and update time of each custom image.
- You can add or delete versions for a custom image as required.
- Click Add Version in the Operation column to add more versions to the image. A maximum of 100 software versions are supported.
- Click Delete in the Operation column, review the impact of the operation, enter DELETE as prompted, and then click OK.
- Deleting an image only disassociates it from SWR. The original image in SWR will remain intact.
- Deleted images cannot be recovered. Exercise caution when performing this operation.
(Optional) Step 4: Create an Image Snapshot
- Log in to the AI DataLake console.
- In the left navigation pane, choose Image Management to open the image management page.
- Click the Image Acceleration tab to open the Image Acceleration page.
- Click Create Image Snapshot in the upper right corner and set parameters.
Table 2 Parameters for creating an image snapshot Parameter
Description
Snapshot Name
The name of the image snapshot, which is used to identify the snapshot purpose.
The name can contain 1 to 190 characters. It must start with a lowercase letter and end with a digit or lowercase letter. Only lowercase letters, digits, and hyphens (-) are allowed.
Target Image
Select the image version for which you want to create an image snapshot.
Snapshot Retention Period
The number of days for retaining a snapshot after it is created. The snapshot is automatically deleted when the retention period expires.
You can select Permanent or Custom. If you select Custom, the value ranges from 1 to 65,536 days.
- Click OK to start creating the image snapshot.
- View the snapshot status in the image snapshot list. When the status changes from Creating to Available, the snapshot is successfully created.
Step 5: Select a Built-in or Custom Image
Select a built-in or custom image when creating an endpoint. For details about engine endpoint support for built-in and custom images, see Supported Images and Image Snapshots.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot