CreateImageBuild
Builds a custom image based on the specified configuration. After the build succeeds, the image is added to the custom images of the current workspace.
Operation description
Request description.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
paiimage:CreateImageBuild |
create |
*All Resource
|
None | None |
Request syntax
POST /api/v1/imagebuilds HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
The idempotency parameter. |
123e4567-e89b-12d3-a456-426655440000 |
| body |
object |
No |
The request body. |
|
| Accessibility |
string |
No |
The visibility.
Valid values:
|
PUBLIC |
| WorkspaceId |
string |
Yes |
The workspace ID. |
12345 |
| Resource |
object |
Yes |
The runtime resources for the task. |
|
| EcsSpec |
string |
No |
The pay-as-you-go resource specification. This parameter is required when you use a public resource group. |
ecs.c6.large |
| ResourceConfig |
object |
No |
The resource configuration. This parameter is required when you use subscription resources and must be left empty when you use a public resource group. |
|
| CPU |
string |
No |
The number of CPU cores. |
4 |
| Memory |
string |
No |
The memory capacity. |
8Gi |
| ResourceId |
string |
No |
The resource quota ID. This parameter applies only to subscription resources. Do not set this parameter when you use pay-as-you-go resources. |
quotaadzoqup693z |
| ResourceType |
string |
No |
The subscription resource type. Only Lingjun resources are supported. This parameter is required when you use subscription resources. Valid values:
|
Lingjun |
| UserVpc |
object |
No |
The user VPC information. This parameter is required when you use a public resource group. |
|
| VpcId |
string |
No |
The VPC ID. When the build task accesses an ACR Enterprise Edition instance, you must specify a VPC that is added to the access control list of the ACR instance. |
vpc-abcdef** |
| SwitchId |
string |
No |
The vSwitch ID. This parameter is optional. |
vs-abcdef** |
| SecurityGroupId |
string |
No |
The security group ID. This parameter is required when you specify the VPC configuration. |
sg-abcdef** |
| ExtendedCidrs |
array |
No |
The extended CIDR blocks.
|
|
|
string |
No |
The extended CIDR block. |
10.0.0.0/24 |
|
| DefaultRoute |
string |
No |
The default routing.
|
eth1 |
| TargetRegistry |
object |
Yes |
The target image service configuration. |
|
| InstanceId |
string |
No |
The image service instance ID. This parameter is required when you use ACR as the image service. |
cri-**abcd |
| Type |
string |
Yes |
Only ACR Enterprise Edition is supported as the target image service. |
AcrEnterprise |
| OverwriteImageTag |
boolean |
No |
Specifies whether to overwrite an existing image version in the image repository. |
|
| BuildConfig |
object |
Yes |
The build configuration. Specifies the content of the Dockerfile to be built. |
|
| Dockerfile |
string |
No |
The content of the Dockerfile to be built. |
FROM ubuntu:18:04 RUN pip3 install numpy==1.19.5 |
| BuildType |
string |
Yes |
The build type. Valid values:
|
PackageInstallation |
| DockerfilePath |
string |
No |
The Dockerfile path, which is a relative path to the mounted context path. Example: docker/Dockerfile. If the mount path is /mnt/data/, the file is located at /mnt/data/docker/Dockerfile. |
docker/Dockerfile |
| RegistryAuths |
object |
No |
The authentication information for a private image registry. You can specify the authentication information for an ACR image registry that does not belong to the current user. Format: {"user_registry_domain":{"Auth":"base64 encoded auth"}}. |
{ "user-test-registry-vpc.cn-wulanchabu.cr.aliyuncs.com": { "Auth": "dXNlcjp0ZXN0" } } |
| DataSources |
array<object> |
No |
The list of data sources. |
|
|
object |
No |
|||
| DataSourceId |
string |
No |
The ID of the dataset in the workspace. Example: d-************zbs. |
d-************zbs |
| Uri |
string |
No |
The storage path, including the endpoint. This parameter is mutually exclusive with DataSourceId. Example: oss://{bucket-name}.oss-{region}-internal.aliyuncs.com/{subPath}/. |
oss://{bucket-name}.oss-{region}-internal.aliyuncs.com/{subPath}/ |
| MountPath |
string |
No |
The mount path. Example: /mnt/data/. |
/mnt/data/ |
| MountAccess |
string |
No |
The read and write permissions. Valid values: RW (default) and RO. |
RO |
| Options |
string |
No |
The custom mount property for the custom dataset. Only OSS is supported. Example: {"fs.oss.download.thread.concurrency":"10"}. |
{"fs.oss.download.thread.concurrency":"10"} |
| DataSourceVersion |
string |
No |
The dataset version. If you specify this parameter, you must also specify DataSourceId. Example: v1. |
v1 |
| RegionId |
string |
No |
The region ID. |
cn-wulanchabu |
| ImageBuildJobName |
string |
No |
The name of the image build job. |
build-my-image |
| Image |
object |
Yes |
The image metadata. |
|
| Name |
string |
Yes |
The naming rules are as follows:
|
test-v1 |
| Description |
string |
No |
The image description. |
Build test image |
| Uri |
string |
Yes |
The image URI. |
user-test-registry-vpc.cn-wulanchabu.cr.aliyuncs.com/pai-test/pai-test:test-v1 |
| Labels |
array<object> |
No |
The image labels. |
|
|
object |
No |
|||
| Key |
string |
No |
The key of the image label. |
key1 |
| Value |
string |
No |
The value of the image label. |
value1 |
| ImageBuildJobTags |
object |
No |
The custom tags for the image build job. |
{"labelKey":"labelValue"} |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
All return values are in JSON format. |
||
| ImageBuildId |
string |
The image build ID. |
build-****ks92 |
| ImageBuildJobId |
string |
The build job ID. |
dlc-****ks92 |
Examples
Success response
JSON format
{
"ImageBuildId": "build-****ks92",
"ImageBuildJobId": "dlc-****ks92"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.