doc-exports/docs/modelarts/api-ref/CreateImage.html
Lai, Weijian 68e5cd0687 ModelArts API 23.3.0 Version.
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2024-06-18 11:02:37 +00:00

367 lines
18 KiB
HTML

<a name="EN-US_TOPIC_0000001909848168"></a><a name="EN-US_TOPIC_0000001909848168"></a>
<h1 class="topictitle1">Saving a Running Instance as a Container Image</h1>
<div id="body0000001588698509"><div class="section"><h4 class="sectiontitle">Function</h4><p>Save the running instance as a container image. In the saved image, the installed dependency package (pip package) is not lost. In VS Code remote development, the plug-ins installed on the server are not lost.</p>
</div>
<div class="section"><h4 class="sectiontitle">Constraints</h4><p>None</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001909848168__atuogenerate_1"><h4 class="sectiontitle">Debugging</h4><p>You can debug this API through automatic authentication in or use the SDK sample code generated by API Explorer.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001909848168__atuogenerate_2"><h4 class="sectiontitle">URI</h4><p>POST /v1/{project_id}/notebooks/{id}/create-image</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Path Parameters</caption><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.3.2.5.1.1"><p>Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.3.2.5.1.2"><p>Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.3.2.5.1.3"><p>Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.4.3.2.5.1.4"><p>Description</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.5.1.1 "><p>id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.5.1.2 "><p>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.5.1.3 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.4.3.2.5.1.4 "><p>Notebook instance ID.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.5.1.1 "><p>project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.5.1.2 "><p>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.3.2.5.1.3 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.4.3.2.5.1.4 "><p>Project ID. For details, see <a href="modelarts_03_0147.html">Obtaining a Project ID and Name</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001909848168__request_ImageCreateReq" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request body parameters</caption><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.5.2.2.5.1.1"><p>Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.5.2.2.5.1.2"><p>Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.5.2.2.5.1.3"><p>Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.5.2.2.5.1.4"><p>Description</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.1 "><p>description</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.2 "><p>No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.3 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.5.2.2.5.1.4 "><p>Image description with a maximum of 512 characters</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.1 "><p>name</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.2 "><p>No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.3 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.5.2.2.5.1.4 "><p>Image name, which contains a maximum of 512 characters, including lowercase letters, digits, hyphens (-), underscores (_), and periods (.)</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.1 "><p>namespace</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.2 "><p>No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.3 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.5.2.2.5.1.4 "><p>Organization to which the image belongs. You can create and view the organization on the <strong>Organization Management</strong> page of the SWR console.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.1 "><p>tag</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.2 "><p>No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.3 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.5.2.2.5.1.4 "><p>Image tag, which contains a maximum of 64 characters, including letters, digits, hyphens (-), underscores (_), and period (.)</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.1 "><p>workspace_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.2 "><p>No</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.5.2.2.5.1.3 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.5.2.2.5.1.4 "><p>Workspace ID. If no workspaces are available, the default value is <strong>0</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Response Parameters</h4><p><strong>Status code: 200</strong></p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001909848168__response_Image" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Response body parameters</caption><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.6.3.2.4.1.1"><p>Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.6.3.2.4.1.2"><p>Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="60%" id="mcps1.3.6.3.2.4.1.3"><p>Description</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>arch</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Processor architecture supported by the image. Options:</p>
<ul><li><p><strong>X86_64</strong>: x86 architecture</p>
</li><li><p><strong>AARCH64</strong>: Arm architecture</p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>create_at</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>Long</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Specifies the time (UTC ms) when the image is created.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>description</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image description with a maximum of 512 characters</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>dev_services</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>Array of strings</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Services supported by the image. Options:</p>
<ul><li><p><strong>NOTEBOOK</strong>: You can access the notebook instance using HTTPS.</p>
</li><li><p><strong>SSH</strong>: You can remotely access the notebook instance from a local IDE through SSH.</p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>ID of the image used for creating notebook instances. The ID is in Universally Unique Identifier (UUID) format.For details, see <a href="ListImage.html">Querying Supported Images</a>.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>name</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image name, which contains a maximum of 512 characters, including lowercase letters, digits, hyphens (-), underscores (_), and periods (.)</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>namespace</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Organization to which the image belongs. You can create and view the organization on the <strong>Organization Management</strong> page of the SWR console.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>origin</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image source, which defaults to <strong>CUSTOMIZE</strong>. Options:</p>
<ul><li><p><strong>CUSTOMIZE</strong>: user-defined image</p>
</li><li><p><strong>IMAGE_SAVE</strong>: image saved using a development environment instance</p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>resource_categories</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>Array of strings</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Flavors supported by the image. Options:</p>
<ul><li><p><strong>CPU</strong></p>
</li><li><p><strong>GPU</strong></p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>service_type</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Supported image types. Options:</p>
<ul><li><p><strong>COMMON</strong>: common image</p>
</li><li><p><strong>INFERENCE</strong>: image used for inference</p>
</li><li><p>TRAIN: image used for training</p>
</li><li><p>DEV: image used for development and debugging</p>
</li><li><p>UNKNOWN: image whose supported services are not specified</p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>size</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>Long</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image size, in unit of KB</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>status</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image status. Options:</p>
<ul><li><p><strong>INIT</strong>: The image is being initialized.</p>
</li><li><p><strong>CREATING</strong>: The image is being saved. In this case, the notebook instance is unavailable.</p>
</li><li><p><strong>CREATE_FAILED</strong>: Saving the image failed.</p>
</li><li><p><strong>ERROR</strong>: An error occurs.</p>
</li><li><p><strong>DELETED</strong>: The image has been deleted.</p>
</li><li><p><strong>ACTIVE</strong>: The image has been saved, which you can view on the SWR console and use to create notebook instances.</p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>status_message</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Build information during image saving</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>support_res_categories</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>Array of strings</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Flavors supported by the image. Options:</p>
<ul><li><p><strong>CPU</strong></p>
</li><li><p><strong>GPU</strong></p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>swr_path</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>SWR image address</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>tag</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image tag</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>type</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image type. Options:</p>
<ul><li><p><strong>BUILD_IN</strong>: built-in system image</p>
</li><li><p><strong>DEDICATED</strong>: private image</p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>update_at</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>Long</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Specifies the time (UTC ms) when the image was last updated.</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>visibility</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Image visibility. Options:</p>
<ul><li><p><strong>PRIVATE</strong>: private image</p>
</li><li><p><strong>PUBLIC</strong>: All users can perform read-only operations based on the image ID.</p>
</li></ul>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.1 "><p>workspace_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.6.3.2.4.1.2 "><p>String</p>
</td>
<td class="cellrowborder" valign="top" width="60%" headers="mcps1.3.6.3.2.4.1.3 "><p>Workspace ID. If no workspaces are available, the default value is <strong>0</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Example Requests</h4><pre class="screen">{
"name" : "pytorch1_4",
"namespace" : "atelier-auto",
"tag" : "20221223",
"description" : "save from notebook-x21d",
"workspace_id" : "0"
}</pre>
</div>
<div class="section"><h4 class="sectiontitle">Example Responses</h4><p><strong>Status code: 200</strong></p>
<p>OK</p>
<pre class="screen">{
"arch" : "x86_64",
"create_at" : 1671786468811,
"description" : "notebook2.0 20200816",
"dev_services" : [ "SSH", "NOTEBOOK" ],
"id" : "4e0d1854-63e5-4517-b683-a0ee97a692a1",
"name" : "pytorch1_4",
"namespace" : "atelier-auto",
"origin" : "IMAGE_SAVE",
"resource_categories" : [ "CPU", "GPU" ],
"service_type" : "TRAIN",
"status" : "INIT",
"swr_path" : "swr.xxxxx.com/atelier-auto/pytorch1_4:20221223",
"tag" : "20221223",
"type" : "DEDICATED",
"update_at" : 1671786468811,
"visibility" : "PRIVATE",
"workspace_id" : "0"
}</pre>
</div>
<div class="section"><h4 class="sectiontitle">Status Codes</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001909848168__status_code" frame="border" border="1" rules="all"><thead align="left"><tr><th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.9.2.1.3.1.1"><p>Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="85%" id="mcps1.3.9.2.1.3.1.2"><p>Description</p>
</th>
</tr>
</thead>
<tbody><tr><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.9.2.1.3.1.1 "><p>200</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.9.2.1.3.1.2 "><p>OK</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.9.2.1.3.1.1 "><p>201</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.9.2.1.3.1.2 "><p>Created</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.9.2.1.3.1.1 "><p>401</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.9.2.1.3.1.2 "><p>Unauthorized</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.9.2.1.3.1.1 "><p>403</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.9.2.1.3.1.2 "><p>Forbidden</p>
</td>
</tr>
<tr><td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.9.2.1.3.1.1 "><p>404</p>
</td>
<td class="cellrowborder" valign="top" width="85%" headers="mcps1.3.9.2.1.3.1.2 "><p>Not Found</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Error Codes</h4><p>See <a href="modelarts_03_0095.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="notebook.html">DevEnviron (New Version)</a></div>
</div>
</div>