หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Data Lake Insight/ User Guide/ Common DLI Management Operations/ Using a Custom Image to Enhance the Job Running Environment

Using a Custom Image to Enhance the Job Running Environment

Updated on 2025-02-14 GMT+08:00

Scenario

To enhance the functions and performance of Spark and Flink jobs, you can create custom images by downloading the base images provided by DLI and adding dependencies (files, JAR files, or software) and private capabilities required for job execution. This changes the container runtime environment for the jobs.

For example, you can add a Python package or C library related to machine learning to a custom image to help you extend functions.

NOTE:

To use the custom image function, you need to have basic knowledge of Docker.

Notes and Constraints

  • The base images provided by DLI must be used to create custom images.
  • You cannot modify the DLI components and directories in the base images.
  • Only Spark Jar and Flink Jar jobs are supported.

Use Process

Figure 1 Process of using a custom image
  1. Obtain DLI base images.
  2. Use Dockerfile to pack dependencies (files, JAR files, or software) required for job execution into the base image to create a custom image.
  3. Publish the custom image to SoftWare Repository for Container (SWR).
  4. On the DLI job editing page, select the created image and run the job.
  5. Check the job execution status.

Obtaining DLI Base Images

Select the base image of the same type as the architecture of the queue.

For the CPU architecture type of a queue, see Viewing Basic Information About a Queue.

Table 1 Obtaining DLI base images

Image Type

Architecture

URL

General image

x86

swr.ap-southeast-3.myhuaweicloud.com/dli-public/spark_general-x86_64:3.3.1-2.3.8.1120250109929356803819072.202501141605

General image

Arm

swr.ap-southeast-3.myhuaweicloud.com/dli-public/spark_general-aarch64:3.3.1-2.3.8.1120250109929356803819072.202501141605

Notebook image

x86

swr.ap-southeast-3.myhuaweicloud.com/dli-public/spark_notebook-x86_64:3.3.1-2.3.8.1120250109929356803819072.202501141605

Notebook image

Arm

swr.ap-southeast-3.myhuaweicloud.com/dli-public/spark_notebook-aarch64:3.3.1-2.3.8.1120250109929356803819072.202501141605

Creating a Custom Image

The following describes how to package TensorFlow into an image to generate a custom image with TensorFlow installed. Then, you can use the image to run jobs in DLI.

  1. Prepare the container environment.

    For details, see "Step 1: Install the Container Engine" in Uploading an Image Through a Container Engine Client.

  2. Log in to the prepared container environment as user root and run a command to obtain the base image.

    In this example, the Spark base image is used and downloaded to the container image environment in 1 by running the following command:

    docker pull Address for downloading the base image

    For details about the address, see Using a Custom Image to Enhance the Job Running Environment.

    For example, to download the Spark base image, run the following command:
    docker pull swr.xxx/dli-public/spark_general-x86_64:3.3.1-2.3.8.1120250109929356803819072.202501141605

  3. Access SWR.

    1. Log in to the SWR management console.
    2. In the navigation pane on the left, choose Dashboard and click Generate Login Command in the upper right corner. On the displayed page, click to copy the login command.
    3. Run the login command on the VM where the container engine is installed.

  4. Create an organization. If an organization has been created, skip this step.

    1. Log in to the SWR management console.
    2. In the navigation pane on the left, choose Organization Management. On the displayed page, click Create Organization in the upper right corner.
    3. Enter the organization name and click OK.

  5. Write a Dockerfile.

    vi Dockerfile

    Pack TensorFlow into the image as follows:

    ARG BASE_IMG=swr.xxx/dli-public/spark_general-x86_64:3.3.1-2.3.8.1120250109929356803819072.202501141605//Replace xxx with the URL of the base image.
    
    FROM ${BASE_IMG} as builder
    USER omm //Run this command as user omm.
    RUN set -ex && \
        mkdir -p /home/omm/.pip && \
        pip3 install tensorflow==2.4.0
    Copy the content to the base image.
    USER omm

    The following steps are included:

    1. Set the available repository address of pip.
    2. Use pip3 to install the TensorFlow algorithm package.
    3. Copy the content in the temporary image builder where the algorithm package is installed to the base image (this step is to reduce the image size) to generate the final custom image.

  6. Use Dockerfile to generate a custom image.

    Format of the image packaging command:
    docker build -t [Custom organization name]/[Custom image name]: [Image version] --build-arg BASE_IMG= [DLI base image path] -f Dockerfile .

    The DLI base image path is the image path in Obtaining DLI Base Images.

    The following is an example:
    docker build -t mydli/spark:2.4 --build-arg BASE_IMG=swr.xxx/dli-public/spark_general-x86_64:3.3.1-2.3.8.1120250109929356803819072.202501141605 -f Dockerfile .

  7. Add a tag to the custom image.

    docker tag [Organization name]/[Image name]:[Image version][Image repository address]/[Organization name]/[Image name:version] in 6

    The following is an example:
    docker tag mydli/spark:2.4 swr.xxx/testdli0617/spark:2.4.5.tensorflow

  8. Upload the custom image.

    docker push [Image repository address]/[Organization name]/[Image name:Version]

    Set [Image repository address]/[Organization name]/[Image name:Version] the same as those in 7.

    The following is an example:
    docker push swr.xxx/testdli0617/spark:2.4.5.tensorflow

  9. When submitting a Spark or Flink JAR job in DLI, select a custom image.

    • Open the Spark job or Flink job editing page on the management console, select the uploaded and shared image from the custom image list, and run the job.
      If you select a non- shared image, the system displays a message indicating that the image is not authorized. You can use the image only after it is authorized. Click Authorize as prompted. Set other job execution parameters and execute the job.
      Figure 2 Selecting a custom image on the DLI Spark job editing page
      Figure 3 Authorizing a Spark job image
      Figure 4 Selecting a custom image on the DLI Flink Jar job editing page
    • Specify the image parameter in job parameters on API to use a custom image to run a job. For details about Spark jobs, see Creating a Batch Processing Job. For details about Flink Jar jobs, see Creating a Flink Jar Job.

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback