A mirror interaction method and device, a terminal device, and a storage medium

CN122653756APending Publication Date: 2026-08-28DALIAN UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611122319.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-08-28

AI Technical Summary

Technical Problem

然而,实际业务交互过程中,第三方所提供镜像是编译后的二进制文件或封装好的脚本,这对于管控平台来说是一个黑盒,使其无法直接获知该镜像支持哪些启动参数,也不知晓这些参数的数据类型和合法范围,现有方式需要开发者额外编写XML/JSON配置文件随镜像上传,后期维护繁琐,且极易出现配置文件更新滞后于镜像版本的情况,导致参数配置错误

Benefits of technology

本申请实施例提供了一种镜像交互方法、装置、终端设备及存储介质,通过在目标镜像的配置层直接植入环境变量参数契约,使得镜像本身即是文档,无需依赖任何外部配置文件,便可利用系统标准接口来透视镜像,从根源上杜绝文件更新滞后导致的配置错误风险,进而依托于自动解析的结构化参数模型在前端显示界面生成交互组件,并对用户输入的环境变量参数值进行实时阻断校验,将获得的真实配置值依照同名环境变量写入容器启动配置,有效拦截了越界或非法参数的提交,防止配置错误造成的任务启动失败,避免了算力资源在任务初始化阶段的无效消耗,显著提升资源利用率和用户体验,操作快捷。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122653756A_ABST
    Figure CN122653756A_ABST
Patent Text Reader

Abstract

The application discloses a mirror image interaction method and device, terminal equipment and storage medium, and relates to the technical field of cloud computing and container arrangement. The mirror image interaction method comprises the following steps: pulling a target image from an image warehouse, implanting an environmental variable parameter contract in a configuration layer of the target image, and analyzing the environmental variable parameter contract through a system standard interface to obtain a structured parameter model, wherein the structured parameter model comprises parameter types and range attributes; generating an interaction component in a front-end display interface based on the structured parameter model, and performing real-time blocking verification on environmental variable parameter values input by a user through the interaction component to obtain real configuration values; and writing the real configuration values into a container start configuration according to the same environmental variables to cover the description information of the same environmental variables in the environmental variable parameter contract. The mirror image interaction method disclosed by the application can quickly and accurately configure parameters and is convenient to operate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of cloud computing and container orchestration technology, and in particular to a method, apparatus, terminal device and storage medium for image interaction. Background Technology

[0002] When applications are deployed in engineering, business code is typically packaged into Docker images and delivered to a management platform for scheduling. However, in actual business interactions, the images provided by third parties are compiled binary files or packaged scripts, which are a black box to the management platform. This prevents the platform from directly knowing which startup parameters the image supports, as well as the data types and valid ranges of these parameters. The current approach requires developers to write additional XML / JSON configuration files and upload them with the image, which is cumbersome to maintain later and is prone to lag behind the image version, leading to incorrect parameter configurations.

[0003] Meanwhile, since users have a very high barrier to entry when operating images directly through the Docker command line, the platform needs to manually develop parameter configuration pages for each newly connected business. However, as the number of images increases, the workload of front-end adaptation and maintenance will increase linearly, which will prevent the platform from scaling up quickly. Summary of the Invention

[0004] In view of the above-mentioned defects or deficiencies in the related technologies, it is desirable to provide a mirror interaction method, device, terminal equipment and storage medium that can quickly and accurately configure parameters and is convenient to operate.

[0005] Firstly, this application provides a mirror interaction method, the mirror interaction method comprising: Pull the target image from the image repository. The configuration layer of the target image has an environment variable parameter contract embedded in it. The environment variable parameter contract is parsed through the system standard interface to obtain a structured parameter model. The structured parameter model includes parameter type and range attributes. Based on the structured parameter model, interactive components are generated on the front-end display interface, and the environmental variable parameter values ​​input by the user through the interactive components are blocked and verified in real time to obtain the real configuration values. The actual configuration value is written into the container startup configuration according to the environment variable with the same name, so as to override the description information of the environment variable with the same name in the environment variable parameter contract.

[0006] Optionally, in some embodiments of this application, the environment variable parameter contract includes an environment variable prefix and adopts a four-segment colon-separated string format of variable type: value range: default value: description information.

[0007] Optionally, in some embodiments of this application, the method of parsing the environment variable parameter contract through the system standard interface to obtain a structured parameter model further includes returning a standardized diagnostic result corresponding to the exception type if an anomaly occurs in the mirror repository during the parsing process.

[0008] Optionally, in some embodiments of this application, the generation of interactive components on the front-end display interface based on the structured parameter model includes: When the parameter type of the structured parameter model is numeric, a slider component is rendered based on the range attribute; and / or, when the parameter type of the structured parameter model is enumeration, a drop-down selection box component is rendered based on the range attribute; and / or, when the parameter type of the structured parameter model is Boolean, a switch component is rendered based on the range attribute.

[0009] Optionally, in some embodiments of this application, writing the actual configuration value into the container startup configuration according to the environment variable of the same name also includes mapping the physical storage resources selected by the user to the container logical path.

[0010] Secondly, this application provides a mirror interaction device, the mirror interaction device comprising: The parsing module is used to pull the target image from the image repository. The configuration layer of the target image has an environment variable parameter contract embedded in it. The system standard interface is used to parse the environment variable parameter contract to obtain a structured parameter model. The structured parameter model includes parameter type and range attributes. The configuration module is used to generate interactive components on the front-end display interface based on the structured parameter model, and to perform real-time blocking verification on the environmental variable parameter values ​​input by the user through the interactive components to obtain the real configuration values. The runtime module is used to write the actual configuration value into the container startup configuration according to the environment variable with the same name, so as to override the description information of the environment variable with the same name in the environment variable parameter contract.

[0011] Optionally, in some embodiments of this application, the environment variable parameter contract includes an environment variable prefix and adopts a four-segment colon-separated string format of variable type: value range: default value: description information.

[0012] Optionally, in some embodiments of this application, the running module is also used to map the physical storage resources selected by the user to the container logical path.

[0013] Thirdly, this application provides a terminal device, the terminal device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the instruction, the program, the code set or instruction set being loaded and executed by the processor to implement the steps of any of the mirror interaction methods in the first aspect.

[0014] Fourthly, this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps of the mirror interaction method described in any one of the first aspects.

[0015] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: This application provides a mirror interaction method, apparatus, terminal device, and storage medium. By directly embedding environment variable parameter contracts into the configuration layer of the target image, the image itself becomes a document, eliminating the need for any external configuration files. The system's standard interface allows for viewing the image, fundamentally preventing configuration errors caused by delayed file updates. Furthermore, based on an automatically parsed structured parameter model, interactive components are generated on the front-end display interface. Real-time blocking and verification of user-input environment variable parameter values ​​are performed, and the obtained actual configuration values ​​are written into the container startup configuration according to the environment variables with the same names. This effectively intercepts out-of-bounds or illegal parameter submissions, preventing task startup failures caused by configuration errors, avoiding ineffective consumption of computing resources during task initialization, significantly improving resource utilization and user experience, and providing fast operation. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating a mirror interaction method provided in an embodiment of this application; Figure 2 This application provides an example of a mirror interaction method. Figure 3 A structural block diagram of a mirror interaction device provided in an embodiment of this application; Figure 4 This is a structural block diagram of a terminal device provided in an embodiment of this application. Detailed Implementation

[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0020] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The following examples illustrate this. Figures 1 to 4 The mirror interaction method, apparatus, terminal device and storage medium provided in the embodiments of this application are described in detail.

[0021] Please refer to Figure 1 This is a flowchart illustrating a mirror interaction method provided in an embodiment of this application. The mirror interaction method specifically includes the following steps: S101, pull the target image from the image repository. The configuration layer of the target image has an environment variable parameter contract embedded in it. The environment variable parameter contract is parsed through the system standard interface to obtain a structured parameter model. The structured parameter model includes parameter type and range attributes.

[0022] It should be noted that the embodiments of this application can utilize the Config Layer of the Docker image as the metadata carrier and define a special four-segment string protocol, thereby combining... Figure 2As shown, developers can directly flash environment variable parameter contracts into the image during the image build process. These contracts include an environment variable prefix (e.g., APP_) and use a four-part colon-separated string format: variable type: value range: default value: description information. For example, a numeric type is ENVAPP_WORKER_NUM numeric:[1,):10: specifies the number of worker threads, the value must be greater than or equal to 1 (left-closed, right-open interval); an enumeration type is ENV APP_LOG_LEVEL enum:{debug,info,error}:info: log level, the parameter can only be selected from debug, info, and error; and a string type is ENV APP_DATA_PATH string:: / data / input: data input path, the double colons in the middle indicate that this string type has no specific value range restriction. At this point, the application's internal code does not need to include logic for parsing the four-part string; subsequently, environment variables can be read directly through standard interfaces such as os.getenv("APP_WORKER_NUM").

[0023] Furthermore, in the image resolution state, the management platform calls the Docker Inspect API to achieve seamless resolution. First, the original "KEY=VALUE" is split into key-value pairs, and compatibility handling is performed for cases with no value, null values, and duplicate keys to avoid subsequent resolution failures. Then, prefix parameters such as HP_ and CONVERT_ are parsed according to a four-segment colon-separated string format to form a structured parameter model that can be used for front-end rendering and validation. For example, HP_BATCH_SIZE=numeric:[1,):32: specifies the batch size for each training iteration. After parsing, the variable type is numeric, the value range is [1,), the default value is 32, and the description information is the specified batch size for each training iteration. For special specification fields, noise reduction processing is performed. For example, DEFAULT_LABELS may contain opening and closing quotes, which need to be removed before JSON parsing to ensure that the label array can be correctly recognized.

[0024] If an anomaly occurs in the image repository during the parsing process, a standardized diagnostic result corresponding to the anomaly type is returned. This is achieved using a "Try-Catch-Fallback" processing chain. In the Try process, the target image is pulled and viewed, and environment variable parameters are read. If successful, parameter parsing and verification are performed. In the Catch process, if the image repository encounters an anomaly such as Internal ServerError, image not found, or connection interruption, the corresponding processing branch is entered according to the anomaly type, such as attempting repair, issuing a prompt, or reconnecting. In the Fallback process, when the image repository returns a non-standard error body or unparseable JSON, it falls back to keyword matching (e.g., not found) and the underlying anomaly is uniformly mapped to a standardized diagnostic result (e.g., unknown error, image not found, connection timeout). The advantage of this setup is that it avoids process interruptions caused by short-term fluctuations in the image repository, non-standard error bodies, or incorrect image addresses, ensures that understandable error information is returned to the user, and prevents non-compliant images from entering the task orchestration stage, thereby improving the stability and maintainability of image access.

[0025] S102 generates interactive components on the front-end display interface based on the structured parameter model, and performs real-time blocking verification on the environmental variable parameter values ​​input by the user through the interactive components to obtain the real configuration values.

[0026] In some embodiments of this application, at least one of the following situations may be included: when the parameter type of the structured parameter model is numeric, a slider component is rendered based on the range attribute; when the parameter type of the structured parameter model is enum, a drop-down selection box component is rendered based on the range attribute; and when the parameter type of the structured parameter model is boolean, a switch component is rendered based on the range attribute. The advantage of this setting is that it greatly reduces the user's operation threshold, enables zero-code rapid adaptation of the front-end interface, and breaks the bottleneck of needing to develop a separate front-end page when a new business image is launched in the traditional mode.

[0027] Furthermore, when the user adjusts the parameters on the display interface, the front-end logic will capture the input environment variable parameter values ​​in real time and compare them with the constraints in the metadata. For example, if the user enters 0 in the HP_IMAGE_NUM input box, the front-end will detect that the range is [1,) and immediately prompt "the value must be greater than or equal to 1" and disable the submit button.

[0028] S103, write the actual configuration value into the container startup configuration according to the environment variable with the same name, so as to override the description information of the environment variable with the same name in the environment variable parameter contract.

[0029] In some embodiments of this application, when the management platform backend converts user configurations into resources such as Kubernetes Jobs, it can use the exact same environment variable names, but replace the description information with the actual configuration values ​​entered by the user. Therefore, in the task runtime, the application reads the actual configuration values ​​instead of the description strings, i.e., variable overwriting. Furthermore, the physical storage resources selected by the user can be mapped to container logical paths (such as / dataset / train, / weight / input, / weight / output), achieving dynamic mounting of fixed container logical paths and variable physical storage resources. This allows the application to only read and write files under the container logical path without needing to concern itself with the specific implementation of the underlying storage, significantly reducing the cost of image adaptation and reuse.

[0030] The image interaction method provided in this application embeds an environment variable parameter contract directly into the configuration layer of the target image, making the image itself a document. Without relying on any external configuration files, the system's standard interface can be used to view the image, fundamentally eliminating the risk of configuration errors caused by delayed file updates. Furthermore, based on an automatically parsed structured parameter model, interactive components are generated on the front-end display interface, and the user-input environment variable parameter values ​​are validated in real time. The obtained actual configuration values ​​are written into the container startup configuration according to the environment variables with the same names, effectively intercepting the submission of out-of-bounds or illegal parameters, preventing task startup failures caused by configuration errors, avoiding the ineffective consumption of computing resources during the task initialization phase, significantly improving resource utilization and user experience, and providing fast operation.

[0031] Based on the foregoing embodiments, this application provides a mirror interaction device 100, which can be applied to... Figures 1 to 2 In the mirror interaction method of the corresponding embodiment, please refer to... Figure 3 The mirror interaction device 100 includes: The parsing module 101 is used to pull the target image from the image repository. The configuration layer of the target image has an environment variable parameter contract embedded in it. The system standard interface is used to parse the environment variable parameter contract to obtain a structured parameter model. The structured parameter model includes parameter type and range attributes. The configuration module 102 is used to generate interactive components on the front-end display interface based on the structured parameter model, and to perform real-time blocking verification on the environmental variable parameter values ​​input by the user through the interactive components to obtain the real configuration values. The runtime module 103 is used to write the actual configuration value into the container startup configuration according to the environment variable with the same name, so as to override the description information of the environment variable with the same name in the environment variable parameter contract.

[0032] Optionally, in some embodiments of this application, the environment variable parameter contract includes an environment variable prefix and adopts a four-segment colon-separated string format of variable type: value range: default value: description information.

[0033] Optionally, in some embodiments of this application, the parsing module 101 is also used to return a standardized diagnostic result corresponding to the exception type when an exception occurs in the mirror repository during the parsing process.

[0034] Optionally, in some embodiments of this application, the configuration module 102 is specifically used to render a slider component based on the range attribute when the parameter type of the structured parameter model is numeric; and / or, to render a drop-down selection box component based on the range attribute when the parameter type of the structured parameter model is enumeration; and / or, to render a switch component based on the range attribute when the parameter type of the structured parameter model is Boolean.

[0035] Optionally, in some embodiments of this application, the running module 103 is also used to map the physical storage resources selected by the user to the container logical path.

[0036] It should be noted that the descriptions of the same steps and contents as in other embodiments in this embodiment can be found in the descriptions in other embodiments, and will not be repeated here.

[0037] The image interaction device provided in this application embodiment directly embeds environment variable parameter contracts into the configuration layer of the target image, making the image itself a document. Without relying on any external configuration files, it can use the system's standard interface to view the image, eliminating the risk of configuration errors caused by delayed file updates from the root. Furthermore, it generates interactive components on the front-end display interface based on the automatically parsed structured parameter model, and performs real-time blocking and verification of the environment variable parameter values ​​input by the user. The obtained real configuration values ​​are written into the container startup configuration according to the environment variables with the same names, effectively intercepting the submission of out-of-bounds or illegal parameters, preventing task startup failures caused by configuration errors, avoiding the ineffective consumption of computing resources during the task initialization phase, significantly improving resource utilization and user experience, and providing fast operation.

[0038] Based on the foregoing embodiments, this application provides a terminal device. Please refer to... Figure 4 The terminal device 200 may include a processor 201 and a memory 202. The memory 202 stores at least one instruction, at least one program, code set, or instruction set, which is loaded and executed by the processor 201 to implement [the desired functionality]. Figures 1 to 2 The steps of the mirror interaction method in the corresponding embodiment.

[0039] In another aspect, embodiments of this application provide a computer-readable storage medium for storing program code for executing the aforementioned... Figures 1 to 2 Any implementation of the mirror interaction method in the corresponding embodiment.

[0040] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0041] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed between each other can be through some interfaces, indirect coupling or communication connection between devices or modules, and can be electrical, mechanical, or other forms. Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0042] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing unit, or each module can exist physically separately, or two or more units can be integrated into one module. The integrated unit can be implemented in hardware or as a software functional unit. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.

[0043] Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the mirror interaction method of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0044] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0045] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A mirror interaction method, characterized in that, The mirror interaction method includes: Pull the target image from the image repository. The configuration layer of the target image has an environment variable parameter contract embedded in it. The environment variable parameter contract is parsed through the system standard interface to obtain a structured parameter model. The structured parameter model includes parameter type and range attributes. Based on the structured parameter model, interactive components are generated on the front-end display interface, and the environmental variable parameter values ​​input by the user through the interactive components are blocked and verified in real time to obtain the real configuration values. The actual configuration value is written into the container startup configuration according to the environment variable with the same name, so as to override the description information of the environment variable with the same name in the environment variable parameter contract.

2. The mirror interaction method according to claim 1, characterized in that, The environment variable parameter contract includes an environment variable prefix and adopts a four-segment colon-separated string format: variable type: value range: default value: description information.

3. The mirror interaction method according to claim 2, characterized in that, The step of parsing the environment variable parameter contract through the system standard interface to obtain a structured parameter model also includes returning a standardized diagnostic result corresponding to the exception type if an exception occurs in the mirror repository during the parsing process.

4. The mirror interaction method according to claim 1, characterized in that, The generation of interactive components on the front-end display interface based on the structured parameter model includes: When the parameter type of the structured parameter model is numeric, a slider component is rendered based on the range attribute; and / or, when the parameter type of the structured parameter model is enumeration, a drop-down selection box component is rendered based on the range attribute; and / or, when the parameter type of the structured parameter model is Boolean, a switch component is rendered based on the range attribute.

5. The mirror interaction method according to any one of claims 1 to 4, characterized in that, The step of writing the actual configuration value into the container startup configuration according to the environment variable with the same name also includes mapping the physical storage resources selected by the user to the container logical path.

6. A mirror interaction device, characterized in that, The mirror interaction device includes: The parsing module is used to pull the target image from the image repository. The configuration layer of the target image has an environment variable parameter contract embedded in it. The system standard interface is used to parse the environment variable parameter contract to obtain a structured parameter model. The structured parameter model includes parameter type and range attributes. The configuration module is used to generate interactive components on the front-end display interface based on the structured parameter model, and to perform real-time blocking verification on the environmental variable parameter values ​​input by the user through the interactive components to obtain the real configuration values. The runtime module is used to write the actual configuration value into the container startup configuration according to the environment variable with the same name, so as to override the description information of the environment variable with the same name in the environment variable parameter contract.

7. The mirror interaction device according to claim 6, characterized in that, The environment variable parameter contract includes an environment variable prefix and adopts a four-segment colon-separated string format: variable type: value range: default value: description information.

8. The mirror interaction device according to any one of claims 6 to 7, characterized in that, The runtime module is also used to map the physical storage resources selected by the user to the container logical path.

9. A terminal device, characterized in that, The terminal device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, code set, or instruction set, and the instruction, program, code set, or instruction set is loaded and executed by the processor to implement the steps of the mirror interaction method according to any one of claims 1 to 5.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps of the mirror interaction method according to any one of claims 1 to 5.